os.system error returns

random832 at fastmail.us random832 at fastmail.us
Fri Jun 12 10:25:28 EDT 2015


On Fri, Jun 12, 2015, at 09:54, Ian Kelly wrote:

> Exit code 0 traditionally means success. The exit status is two bytes,
> with
> the low-order byte normally containing the exit code and the high-order
> byte containing the signal that caused the program to exit.

That's backwards. The signal (or 0 for a normal exit, or 0177 if the
process is stopped) is in the low seven bits of the low-order byte, the
core dump flag is in the high bit of the low-order byte and the exit
status or the stop signal is in the high-order byte.

I think you're confused because the _shell_ puts the exit status, or the
signal plus 128, in the $? variable, and many languages (but not python)
follow suit.



More information about the Python-list mailing list