Closed jmv74211 closed 1 year ago
We want to build a class to be able to execute processes locally, so that both the result, output, stderr... is managed in a simple and parameterized way. The objective is to provide a high-level layer to the psutil
library in relation to run processes.
Process():
- Attributes:
- command (str or list(str)): Command (string or splitted in list) to run.
- capture_stdout (boolean): True for capturing the process stdout, False otherwise.
- capture_stderr (boolean): True for capturing the process stderr, False otherwise.
- stdout (str): Process stdout if captured with capture_stdout=True.
- stderr (str): Process stderr if captured with capture_stderr=True.
- wait (boolean): True for waiting until the process is finished, False otherwise.
- timeout (int): Num seconds to wait until the process is finished. If it's exceeded, exception will be generated.
- process (psutil.Process): Process object.
- Methods:
- run
- get_stdout
- get_stderr
- get_status
- get_pid
- kill
- get_return_code
It is requested to create a module that allows us to manage process execution locally.