8.15 Standard Module popen2

This module allows you to spawn processes and connect their input/output/error pipes and obtain their return codes.

The primary interface offered by this module is a pair of factory functions:

popen2 (cmd[, bufsize])
Executes cmd as a sub-process. If bufsize is specified, it specifies the buffer size for the I/O pipes. Returns (child_stdout, child_stdin).

popen2 (cmd[, bufsize])
Executes cmd as a sub-process. If bufsize is specified, it specifies the buffer size for the I/O pipes. Returns (child_stdout, child_stdin, child_stderr).

The class defining the objects returned by the factory functions is also available:

Popen3 (cmd[, capturestderr[, bufsize]])
This class represents a child process. Normally, Popen3 instances are created using the factory functions described above.

If not using one off the helper functions to create Popen3 objects, the parameter cmd is the shell command to execute in a sub-process. The capturestderr flag, if true, specifies that the object should capture standard error output of the child process. The default is false. If the bufsize parameter is specified, it specifies the size of the I/O buffers to/from the child process.