Process and BaseProcess
The Process library provides solution to execute a command, to control its execution, to redirect its outputs and input.
Creation of process handlers
The main interfaces are
BASE_PROCESS. The factory helps to instantiate a
BASE_PROCESS object, which is the execution controller. The
BASE_PROCESS object is used to configure the execution, to launch the execution, and check for the termination. It could also terminate the execution if wanted.
The factory interface provides 2 useful functions creating a
process_launchertakes as parameters the file name of the executable, then the arguments as a list of strings, and an optional working directory.
process_launcher_with_command_lineis similar to
process_launcher, but takes the full command line, instead of executable filename and arguments.
The advantage of
process_launcher is that you do not have to care about quoting the argument values.
BASE_PROCESS object, it is possible to configure the execution.
- It is possible to redirect the standard and error output, and also the input, for instance:
redirect_output_to_fileis used to record the execution output in a file
redirect_error_to_same_as_outputis used to redirect the error output with the standard output
redirect_input_to_fileis used to take the input from a file.
- check other
| ||If True, the launched process will have terminal control over standard input, output and error.|
| ||If True, the process will be launched silently (no console window will prompt out).|
| ||If True, the process will be launched with a new console instead of inheriting parent's console.|
| ||If True, the process will be launched without any console.|
| ||Launch the execution.|
| || Terminate launched execution. Check |
| || Terminate process tree starting from current launched process. Check |
| ||Wait until process has exited.|
| || Wait launched process to exit for at most |
| ||Close handles associated with child process. The process may continue running. If there is any input/output redirection to/from current process, it will be closed.|
| ||Identifier of the last launched process.|
| ||Exit code of child process. It should be called after the process has exited.|
| ||It is a facility to know which is the current platform.|
| || Has the process been launched? Check after a call to |
| ||Is the process still running (i.e launched and not exited)?|
| ||Has launched process exited and have allocated resources been cleaned up?|
The Process library is an extension of the BaseProcess library, the main interfaces are
PROCESS_FACTORYwhich inherits from
PROCESSwhich inherits from
BASE_PROCESSand add agent based redirection.
The agent based redirections can be useful to process the execution output as it comes, and also to send data to the input.