:py:mod:`oioioi.base.utils.execute` =================================== .. py:module:: oioioi.base.utils.execute Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: oioioi.base.utils.execute.quote oioioi.base.utils.execute.execute Attributes ~~~~~~~~~~ .. autoapisummary:: oioioi.base.utils.execute._safechars .. py:data:: _safechars .. py:function:: quote(file) Return a shell-escaped version of the file string. .. py:exception:: ExecuteError Bases: :py:obj:`RuntimeError` Unspecified run-time error. .. py:function:: execute(command, env=None, split_lines=False, ignore_errors=False, errors_to_ignore=(), stdin=b'', cwd=None, capture_output=True) Utility function to execute a command and return the output. It's basically a little saner version of subprocess.call. :param command: a string or a list; command to be executed :param env: environment dictionary :param split_lines: On True, the result lines are returned separated :param ignore_errors: On False, throw an exception if the command returned a non-zero return code. :param errors_to_ignore: tuple of return codes not to be interpreted as errors :param stdin: a bytestring passed to the subprocess :param cwd: working directory to temporarily chdir to :param capture_output: if False, output will be passed to stdout/stderr :returns: the standard output of the subprocess in a bytestring