How to get return values of a forked process

Ian Kelly ian.g.kelly at gmail.com
Tue Jun 21 15:31:28 EDT 2011


> Where did you find the Unix docs you pasted in?  I didn't find it in
> the man pages.  Thank you.  Based on what you say, I will change my
> os._exit() to sys.exit().

http://docs.python.org/library/os.html#os.wait
http://docs.python.org/library/os.html#os.waitpid

I don't know what man pages you were looking at, but the Unix system
call does work the same way; to extract the exit status in C you're
supposed to use the WEXITSTATUS(status) macro, which is typically
implemented as ((status >> 8) & 0377).  See:

http://linux.die.net/man/2/waitpid



More information about the Python-list mailing list