orphan:, interactive=False, timeout=None, detached=False, stdout=None, stderr=None, *args, **kwargs)

Run the specified command.

This function manually captures the output and writes it to sys.stdout, meaning that replacing sys.stdout with a StringIO stream can be used to handle combined subprocess and python output more easily.

Example usage:

from carputils import divertoutput['ls', '-ltr', 'mydir/'])

When used with the subprocess_exceptions() context manager, checks the return code of the finished process and raises an exception if it did not exit correctly.

See also the context manager, which allows control of the destination of the process output streams.

cmd : list of str
List of command line arguments to execute.