why does popen2 silently ignore IOError?

David Bolen db3l at fitlinxx.com
Wed Feb 20 20:25:18 EST 2002


"Donn Cave" <donn at u.washington.edu> writes:

> popen is actually a bit better than popen2 here, though, inasmuch as when
> you close the file object you get a special return value with the exit
> status.  To get this value with popen2, you need to use the Popen3 class
> and call its wait() member function.

Or on Windows, which doesn't have the Popen3/4 classes, you get the
exit status on close for any of the os.popen# calls (in Python 2.0 or
greater since before that only os.popen was in the standard library
for Windows).  For the popen2-popen4 calls, the exit code is retrieved
when you close the final file from the set returned by the initial
popen# call.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list