carputils.divertoutput.call

orphan:

carputils.divertoutput.call(cmd, 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
divertoutput.call(['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 carputils.stream.divert_std() context manager, which allows control of the destination of the process output streams.

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