A convenient class to execute a subprocess.
A sppasExecProcess is a wrapper of 'subprocess.Popen' command. The sppasExecProcess class is a convenient wrapper for executing subprocesses in Python. It provides methods for running a command, getting the stdout and stderr of the command, stopping a running command, and checking the status of the command.
The main functionalities of the sppasExecProcess class are:
- Running a command using 'subprocess.Popen' or 'subprocess.run'
- Getting the stdout and stderr of the executed command
- Stopping a running command
- Checking the status of the executed command
Example
>>> # Launch a command:
>>> p = sppasExecProcess()
>>> p.run_popen("ls -l")
>>> # Get the stdout of the command:
>>> p.out()
>>> # Get the stderr of the command:
>>> p.error()
>>> # Stop a command:
>>> p.stop()
>>> # Get the state of the command:
>>> p.is_running()