User Tools

Site Tools


k21:start

21.0 Process Management

This chapter introduces the Process class and the EXEC and SHELL instructions. These instructions are natively part of the Gambas vocabulary; however, they are not objects and have a syntax different from functions.

The Process class describes process management in Gambas in a narrower sense and is used to manage internal processes started by EXEC or SHELL.

PING
Figure 21.0.1: Programme 'ping' - displaying the outputs

First, the most important properties and methods of the Process class are described and the close relationship between the Process and Stream classes is introduced. Then the syntax of the instructions EXEC and SHELL is introduced and explained. Subsequently, the use of the instructions EXEC and SHELL is described, whereby the similarities are discussed and the differences are highlighted.

  • SHELL, for example, calls the /bin/dash programme under Ubuntu and passes it a command line that is analysed. The command contained with the optionally passed parameters is executed as in a normal shell.
  • EXEC, on the other hand, uses the execve() system call to start a programme bypassing the shell and is thus faster. However, you lose some of the advantages provided by the shell when using EXEC because there are restrictions in the call.

Finally, several projects are presented in which the theoretical approaches presented for the SHELL and EXEC instructions are implemented:

  • Starting external programmes with GUI.
  • Starting external (console) programmes and displaying the output of these programmes.
  • Start of external programmes and evaluation of the outputs as well as display of the outputs of these programmes evaluated and formatted according to specific criteria.
  • Start of external programmes - not only under root rights - with secure input of passwords.
  • Start of external programs and interaction of main program and external program under the aspects of data exchange and process control as typical for graphical user interfaces (GUI) for console programs. * List Item

Primarily, the use of the EXEC and SHELL instructions is for the development and testing of graphical user interfaces (GUI) for the external command-line controlled and interactive programs. But they are also very suitable for executing individual commands in the background.

The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k21/start.txt · Last modified: 18.05.2022 (external edit)

Page Tools