Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child.
communicate() returns a tuple (stdout, stderr).
Create a pipe with FDs set CLOEXEC.
Wait for child process to terminate. Returns returncode attribute.
Send a signal to the process
Terminate the process with SIGTERM
Kill the process with SIGKILL
Run command with arguments. Wait for command to complete, then return the returncode attribute.
The arguments are the same as for the Popen constructor. Example:
retcode = call([“ls”, “-l”])
Run command with arguments. Wait for command to complete. If the exit code was zero then return, otherwise raise CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute.
The arguments are the same as for the Popen constructor. Example:
check_call([“ls”, “-l”])
Run command with arguments and return its output as a byte string.
If the exit code was non-zero it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute and output in the output attribute.
The arguments are the same as for the Popen constructor. Example:
>>> check_output(["ls", "-1", "/dev/null"])
'/dev/null\n'
The stdout argument is not allowed as it is used internally. To capture standard error in the result, use stderr=STDOUT.
>>> check_output(["/bin/sh", "-c", "echo hello world"], stderr=STDOUT)
'hello world\n'
This exception is raised when a process run by check_call() or check_output() returns a non-zero exit status. The exit status will be stored in the returncode attribute; check_output() will also store the output in the output attribute.