Module popen2
[hide private]
[frames] | no frames]

Module popen2

Spawn a command with pipes to its stdin, stdout, and optionally stderr.

The normal os.popen(cmd, mode) call spawns a shell command and provides a file interface to just the input or output of the process depending on whether mode is 'r' or 'w'. This module provides the functions popen2(cmd) and popen3(cmd) which return two or three pipes to the spawned command.

Classes [hide private]
Popen3
Class representing a child process.
Popen4
Functions [hide private]
 
_cleanup()
 
popen2(cmd, bufsize=-1, mode='t')
Execute the shell command 'cmd' in a sub-process.
 
popen3(cmd, bufsize=-1, mode='t')
Execute the shell command 'cmd' in a sub-process.
 
popen4(cmd, bufsize=-1, mode='t')
Execute the shell command 'cmd' in a sub-process.
 
_test()
Variables [hide private]
  MAXFD = 1024
  _active = []

Imports: os, sys


Function Details [hide private]

popen2(cmd, bufsize=-1, mode='t')

 

Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdout, child_stdin) are returned.

popen3(cmd, bufsize=-1, mode='t')

 

Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdout, child_stdin, child_stderr) are returned.

popen4(cmd, bufsize=-1, mode='t')

 

Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' may be a sequence, in which case arguments will be passed directly to the program without shell intervention (as with os.spawnv()). If 'cmd' is a string it will be passed to the shell (as with os.system()). If 'bufsize' is specified, it sets the buffer size for the I/O pipes. The file objects (child_stdout_stderr, child_stdin) are returned.