API¶
-
procrunner.
run
(command, timeout=None, debug=False, stdin=None, print_stdout=True, print_stderr=True, callback_stdout=None, callback_stderr=None, environment=None, environment_override=None, win32resolve=True)[source]¶ Run an external process.
Parameters: - command (array) – Command line to be run, specified as array.
- timeout – Terminate program execution after this many seconds.
- debug (boolean) – Enable further debug messages.
- stdin – Optional string that is passed to command stdin.
- print_stdout (boolean) – Pass stdout through to sys.stdout.
- print_stderr (boolean) – Pass stderr through to sys.stderr.
- callback_stdout – Optional function which is called for each stdout line.
- callback_stderr – Optional function which is called for each stderr line.
- environment (dict) – The full execution environment for the command.
- environment_override (dict) – Change environment variables from the current values for command execution.
- win32resolve – If on Windows, find the appropriate executable first. This allows running of .bat, .cmd, etc. files without explicitly specifying their extension.
Returns: A dictionary containing stdout, stderr, runtime, exitcode, and more.