pymzn.utils.run

pymzn.utils.run(args, stdin=None)

Executes a command and waits for the result.

It is also possible to interrupt the execution of the command with CTRL+C on the shell terminal (only in single thread).

Parameters:
  • args (list) – The list of arguments for the program to execute. Arguments should be formatted as for the subprocess.Popen constructor.
  • stdin (str or bytes) – String or bytes containing the input stream for the process.
Returns:

An instance of CompletedProcess containing the information about the executed process, including stdout, stderr and running time.

Return type:

CompletedProcess

Raises:

CalledProcessError – When the process returns an error.