os.popen4 and exit codes

David Bolen db3l at fitlinxx.com
Tue Mar 19 18:12:08 EST 2002


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

> On UNIX, popen3 is implemented in Python, out of fork and pipe functions,
> and unlike popen it returns 100% stock, common file objects.
> 
> To get exit status, you have to use the Popen3 class explicitly, so you
> can call its wait() function.

Right - the Windows behavior is sort of a kludge (albeit a convenient
one) because of the lack of an equivalent capability in terms of how
the child process is controlled.  Earlier implementations (the
os.popen# functions originated as a contribution to the win32all
package) lost the exit code under Windows entirely :-)

Unfortunately, it makes handling this platform-dependent, but at least
you can get the exit codes in general.

--
-- 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