Tools for running external processes using the subprocess module.
Classes
BaseToolController([logger]) | Base class for controlling command line tools. |
StdToolController([logger]) | Class for controlling command line tools. |
Bases: exectools.BaseToolController
Class for controlling command line tools.
A tool controller runs an external tool in controlled way. The output of the child process is handled by the controller and, optionally, notifications can be achieved at sub-process termination.
A tool controller also allow to stop the controlled process.
Perform finalization actions.
This method is called when the controlled process terminates to perform finalization actions like:
This method is not meant to be called by the user but the user can provide custom implementations in subclasses.
If one just needs to perfor some additional finalization action it should be better to use a custom “finalize_run_hook” instead of overriging “finalize_run”.
Handle standard error.
This method is not meant to be directly called by the user.
The user, anyway, can provide a custom implementation in derived classes.
Handle standard output data.
This method is not meant to be directly called by the user.
The user, anyway, can provide a custom implementation in derived classes.
Reset the tool controller instance.
Kill the controlled subprocess and reset the controller instance loosing all unprocessed data.
Run an external tool in controlled way.
The output of the child process is handled by the controller and, optionally, notifications can be achieved at sub-process termination.
Stop the execution of controlled subprocess.
When this method is invoked the controller instance is always reset even if the controller is unable to stop the subprocess.
When possible the controller try to kill the subprocess in a polite way. If this fails it also tryes brute killing by default (force=True). This behaviour can be controlled using the force parameter.