os.popen4 and exit codes

Donn Cave donn at u.washington.edu
Mon Mar 18 18:22:11 EST 2002


Quoth Don Garrett <garrett at bgb.cc>:
|   My understanding for the popen2-4 functions was that they returned the exit
| code as the result of the last related call to close(). This seems to be
| working for me under Windows, but not Linux. This is the inverse of what I
| would expect.

|   The close DOES return the exit code when I use os.popen(), but I need to be
| able to capture stderr.

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.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list