[Python-Dev] popen behavior
Kevin Butler
kbutler@campuspipeline.com
Tue, 18 Jun 2002 11:20:59 -0600
I've done some work implementing popen* for Jython, and had a couple of questions:
- Should we maintain the os.popen & popen2.popen dual exposure with their
different argument & return value orders?
The 'os' exposure is newer, so I assume it is preferred. The calls follow
these patterns:
stdin, stdout, stderr = os.popen*( command, mode, bufsize )
stdout, stdin, stderr = popen2.popen*( command, bufsize, mode )
- Should we maintain the different behavior for lists of arguments vs strings?
(it does not appear to be documented)
That is, the command can be either a string or a list of strings. If it is a
list of strings, it is executed as a new process without a shell. If it is a
string, CPython's popen2 module attempts to execute it as a shell command-line
as follows:
if isinstance(cmd, types.StringTypes):
cmd = ['/bin/sh', '-c', cmd]
Thanks
kb