[Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.63,1.64 libpopen2.tex,1.14,1.15

Fred L. Drake, Jr. fdrake@acm.org
Tue, 11 Sep 2001 16:23:16 -0400

Tim Peters writes:
 > I'm not sure that's true, but don't know.  Mark Hammond seemed to believe
 > you can get them on Windows (and also Unix?) from the value returned by
 > e.close() where e is the stderr object returned by these functions (in
 > analogy with how plain popen works).

  This does not appear to be the case on Linux:

>>> import popen2
>>> childout, childin = popen2.popen2("cat foo")
>>> cat: foo: No such file or directory
<open file '(fdopen)', mode 'w' at 0x815d528>
>>> childin.close()
>>> childout.close()

  [None returned from both close() methods.]
  Looking at the code in popen2, I don't see any way to dig the return
code out unless something is done to ensure the Popen3/4 object is
kept alive and the close() methods of the file object automagically
called the wait() method.  It might be possible, but the code as
written does not support this on Unix.


Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation