popen2.popen2/3/4 functions can be a sequence. All texts are a variation on the
following:
On \UNIX, \var{cmd} may be a sequence, in which case arguments will be passed
directly to the program without shell intervention (as with
\function{os.spawnv()}). If \var{cmd} is a string it will be passed to the shell
(as with \function{os.system()}).
popen2(), popen3(): Reversed order of bufsize and mode parameters to
comply with what was here before (Python 1.5.2).
class Popen3: Factored the __init__() into a more basic initializer and
a helper method, to allow some re-use by the Popen4 class.
Use os.dup2() instead of os.dup() to create the proper
file descriptors in the child process.
This closes SourceForge bug #115330 and partially closes#115353.
newlines at the start or end. Fiddle test_popen2 and popen2._test() to
tolerate this. Also change all "assert"s in these tests to raise
explicit exceptions, so that python -O doesn't render them useless.
Also, in case of error, make the msg display the reprs of what we
wrote and what we read, so we can tell exactly why it's failing.
os.name == "nt". This makes test_popen2 pass under Win98SE.
HOWEVER, the Win98 "more" invents a leading newline out
of thin air, and I'm not sure that the other Windows flavors
of "more" also do that.
So, somebody please try under other Windows flavors!
windows.
- added optional mode argument to popen2/popen3
for unix; if the second argument is an integer,
it's assumed to be the buffer size.
- changed nt.popen2/popen3/popen4 return values
to match the popen2 module (stdout first, not
stdin).
who writes:
Here is batch 2, as a big collection of CVS context diffs.
Along with moving comments into docstrings, i've added a
couple of missing docstrings and attempted to make sure more
module docstrings begin with a one-line summary.
I did not add docstrings to the methods in profile.py for
fear of upsetting any careful optimizations there, though
i did move class documentation into class docstrings.
The convention i'm using is to leave credits/version/copyright
type of stuff in # comments, and move the rest of the descriptive
stuff about module usage into module docstrings. Hope this is
okay.
terminated; this makes the final assert in the self-test code fail if
the parent runs faster than the children. Fix this by calling wait()
on the remaining children instead.
os.fdopen() calls unbuffered. I presume that it's enough if we can
make all three of them (for stdin, stdout, and stderr) unbuffered and
don't need to specify different buffer sizes per file -- that would
complicate the interface more than I care for.