commands.getstatusoutput result is not command line exit value!!!

"Martin v. Löwis" martin at v.loewis.de
Mon Oct 2 18:43:06 CEST 2006


Hari Sekhon schrieb:
> I'm sorry, this may seem dense to you but I have to ask. What on earth
> are you talking about?

You may not be dense, but you are certainly fairly aggressive in your
postings. If you just want to complain, go ahead. If you want actual
help, you should reconsider your tone.

> Why is it shifted 8 bits to the left?

As Steve says, that what the system returns (from popen(3)), in this
case. It's the true exit status, not just the exit code.

> Why is there bitshifting at all?

Read some Unix book.

> Why doesn't commands give the same exit value as os.system() and the
> unix cli?

Read some Unix book.

> When you choose to exit a program you give it a return value to exit
> with, so why would this change, I exit with the number 1 then expect
> that number to be the exit code, right?

Read some Unix book. Hint: how do you know whether the program was
killed, and didn't actually invoke exit(3)?

> Where do these higher numbers
> come into the equation and why?

Read some Unix book. Hint: Read about WIFEXITED, WIFSIGNALED, and
WEXITSTATUS.

> Please assume that I am not a mind reader and require explanation before
> I can understand.

You are apparently not a documentation reader, as well. Nobody owes you
an explanation.

Regards,
Martin



More information about the Python-list mailing list