oioioi.base.utils.execute
¶
Module Contents¶
Functions¶
Attributes¶
- exception oioioi.base.utils.execute.ExecuteError[source]¶
Bases:
RuntimeError
Unspecified run-time error.
- oioioi.base.utils.execute.execute(command, env=None, split_lines=False, ignore_errors=False, errors_to_ignore=(), stdin=b'', cwd=None, capture_output=True)[source]¶
Utility function to execute a command and return the output. It’s basically a little saner version of subprocess.call.
- Parameters
command – a string or a list; command to be executed
env – environment dictionary
split_lines – On True, the result lines are returned separated
ignore_errors – On False, throw an exception if the command returned a non-zero return code.
errors_to_ignore – tuple of return codes not to be interpreted as errors
stdin – a bytestring passed to the subprocess
cwd – working directory to temporarily chdir to
capture_output – if False, output will be passed to stdout/stderr
- Returns
the standard output of the subprocess in a bytestring