Launches a process in place of the host process.
exec( command )
command | A single string with the system command, or an array of parameters. | ||
Return | Never returns. | ||
Raise |
|
On Unix-like systems, and wherever this feature is present, exec() calls an underlying OS request that swaps out the host process and executes the required command. This feature is often desirable for scripts that has just to setup an environment for a program they call thereafter, or for scripts selecting one program to execute from a list of possible programs. Where this function call is not provided, exec is implemented by calling the required process passing the current environment and then quitting the host program in the fastest possible way.
Embedders may be willing to turn off this feature by unexporting the exec symbol before linking the process module in the VM.
The command parameter may be a complete string holding the command line of the program to be executed, or it may be an array where the first element is the program, and the other elements will be passed as parameters. If the program name is not an absolute path, it is searched in the system execution search path.
Executes an external process and waits for its termination.
pread( command, background )
command | A string representing the program to be executed and its arguments, or an array whose first element is the program, and the others are the arguments. | ||
background | If given and true, the process runs hidden. | ||
Return | The full output generated by the rpcess. | ||
Raise |
|
This function launches an external system command and waits until the command execution is terminated, returning the exit code of the child process. All the
for example:
dir_contents = pread( "ls" ) > dir_contents
If the process cannot be started if it fails to start, an error is raised.
note This function uses the standard system shell to execute the passed commands, so it is possible to pipe applications and redirect streams via the standard "|" and ">" command line characters.
Returns the process ID of the process hosting the Falcon VM.
processId()
Return | a numeric process ID. |
For command line Falcon interpreter, this ID may be considered the ID of the Falcon program being executed; in embedding applications, the function will return the process ID associated with the host application.
Terminates the given process given its ID, if possible.
processKill( pid, [severe] )
pid | The Process ID of the process that should be terminated. |
severe | If given and true, use the maximum severity allowable to stop the given process. |
Return | True on success, false on failure. |
The process having the given PID is terminated. On UNIX systems, a TERM signal is sent to the process. If severe is true, the process is stopped in the most hard way the system provides; i.e. in UNIX, KILL signal is sent.
Executes an external process via command shell, and waits for its termination.
system( command, background )
command | The command to be executed. | ||
background | If given and true, the process runs hidden. | ||
Return | Exit status of the process. | ||
Raise |
|
This function launches an external system command and waits until the command execution is complete, returning the exit code of the child process. The process is actually executed by passing the command string to the system command shell. In this way, it is possible to execute commands that are parsed by the shell.
This includes internal commands as "dir" in Windows systems, or small scripts as "for file in $(ls); do touch $file; done" if the system shell is sh. However, loading the shell may generate a needless overhead for the most common usages of system(). Use systemCall() if there isn't the need to have the system shell to parse the command.
If the background parameter is true, the execution of the child process is hidden; in example, on systems allocating virtual consoles to new processes, the child is given the parent's console instead. When running inside Window Managers and graphical systems, icons representing the process are usually not visible when this option is set.
Executes an external process and waits for its termination.
systemCall( command, background )
command | The command to be executed. | ||
background | If given and true, the process runs hidden. | ||
Return | Exit status of the process. | ||
Raise |
|
This function launches an external system command and waits until the command execution is terminated, returning the exit code of the child process. The command is searched in the system path, if an absolute path is not given. A simple parsing is performed on the string executing the command, so that parameters between quotes are sent to the child process as a single parameter; in example:
retval = systemCall( "myprog alfa beta \"delta gamma\" omega" )
In this case, the child process will receive four parameters, the third of which being the two words between quotes. Those quotes are not passed to the child process.
If the background parameter is true, the execution of the child process is hidden; in example, on systems allocating virtual consoles to new processes, the child is given the parent's console instead. Icons representing the process are usually not visible when this option is set.