os.system() << 8 ?

Donn Cave donn at u.washington.edu
Wed May 28 12:43:58 EDT 2003


| os.system() return the *exit* code from an application but not the value 
| returned
| by return.

On the contrary, "return n" from main() is the same as "exit(n)",
at least in common C implementations on UNIX.  The exit status
provided to the parent fork contains this return value and a couple
other status values pertaining to the cause of death.  On UNIX
platforms the integer exit value is shifted up 8 bits, and the
low 8 bits contains information about signals if one occurred, but
I expect POSIX requires only that WEXITSTATUS yield the correct
value - better to use that to do whatever shifting is necessary.

	Donn Cave, donn at u.washington.edu




More information about the Python-list mailing list