> lang > exec | ![]() |
Previous Next Edit Rename Undo Refresh Search Administration
| Documentation |
|
[ Process = ] EXEC Command [ WAIT ] [ FOR { { READ | INPUT } | { WRITE | OUTPUT } } ] [ AS Name ]
EXEC Command TO VariableExecutes a command. An internal Process object is created to manage the command.
The command must be specified as an array of strings containing at least one element. The first element of this array is the name of the command, and the others are optional parameters.
Name is the event name used by the Process object. By default, it is "Process".
3.0 In Gambas 3, there is no default event name anymore.
In other words, you must add AS "Process" to get the same behaviour as Gambas 2. |
You can get a reference to the internal Process object created by using an assignment.
If you use the second syntax, the command is executed, the interpreter waiting for its end, and the complete command output is put in the specified string.
You have no control on the executed process.
3.0 EnvironmentYou can specify new environment variables for the running process by using the WITH keyword just after the command argument:
[ Process = ] EXEC Command WITH Environment ... Environment is an array of strings, each string having the following form: "NAME=VALUE". NAME is the name of the environment variable, VALUE is its value. If you want to erase an environment variable, just use the string "NAME=".
Running Inside A Virtual TerminalIf the process is run inside a virtual terminal, i.e. if you use the FOR INPUT / OUTPUT syntax, then you can send control characters to the process standard input to get the same effect as if you enter them inside a real terminal. ^C stops the process, ^Z suspends it, and so on. |