please help me understand os.system() result

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed May 21 03:54:41 EDT 2003


Erik Max Francis <max at alcyone.com> wrote in 
news:3ECA4B23.6A56F736 at alcyone.com:

> Duncan Booth wrote:
> 
>> It looks to me as though the documentation is slightly broken at least
>> on
>> Windows systems. It says the return value is in the format specified
>> for
>> wait, but wait is not implemented on Windows systems.
> 
> No, the documentation explicitly states that it returns the value
> returned by wait, except on Windows "where it is always 0."

No, it says that on Windows 95 and 98 it is always 0. I don't know the 
truth or otherwise of that statement, but on Windows 2000, and I assume 
therefore also NT and XP, it returns the exit code.

You even trimmed the example from my post which was cut and pasted on a 
Windows 2000 system:

>>>> os.system('''python -c "import sys; sys.exit(23)"''')
> 23




-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list