Different behavior with multiprocessing
Tomas Kotal
tomas.kotal at gmail.com
Mon Mar 4 10:12:02 EST 2013
> Under Unix, the return value from os.system() encodes more than one
>
> piece of information:
>
>
>
> http://docs.python.org/2/library/os.html#os.system
>
> http://docs.python.org/2/library/os.html#os.wait
>
>
>
> 32512 is 127*256, meaning that the shell exited with return code 127
>
> when given an unrecognized command.
>
>
>
> ChrisA
Well the point is not the difference between return values of os.system under Windows and Linux.
The point is that I set the exist code of child process with os._exit() which works fine on Windows but on Linux the process.exitcode returns always 0.
What is very strange is, that if I set return code to some other value, like:
...
os._exit( len(cmd) )
...
Then I got exit codes 3 and 2 under Linux, which is correct. But when I do something like this:
...
ret = os.system(cmd)
print ret # this print real value, like 32512
os._exit(ret) # exitcode of this child process will be 0 on Linux
...
It doesn't work, which seems very strange to me.
More information about the Python-list
mailing list