upsies.utils.subproc
Execute external commands
Functions
- upsies.utils.subproc.run(argv, *, ignore_errors=False, join_stderr=False, return_exitcode=False, communicate=False)[source]
Execute command in subprocess
- Parameters:
- Raises:
DependencyError – if the command fails to execute
ProcessError – if stdout is not empty and ignore_errors is False
- Returns:
Output from process
- Return type:
Classes
- class upsies.utils.subproc.Process(popen)[source]
Bases:
objectConvenience wrapper around
subprocess.PopenThe main benefit of it is that you can easily iterate over lines on stdout or stderr.
- property stdout
Iterator that yields lines from standard output
If there is nothing to read, an empty string is yielded after a short timeout to prevent your loop from being blocked.
- property stderr
Iterator that yields lines from standard error or nothing if standard error is redirected to standard out.
If there is nothing to read, an empty string is yielded after a short timeout to prevent your loop from being blocked.
- property is_running
Whether the process is still running
- terminate()[source]
Ask process to terminate (SIGTERM) and kill it (SIGKILL) if it doesn’t do that after 1 second
This method does nothing if the process is not running.
- property exitcode
Exit code or termination signal after process ended