Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40454

Re: Different behavior with multiprocessing

Newsgroups comp.lang.python
Date 2013-03-04 07:12 -0800
References <c25680d3-6814-4d5f-a5a2-aa4b9bb0c3a0@googlegroups.com> <mailman.2840.1362409142.2939.python-list@python.org>
Subject Re: Different behavior with multiprocessing
From Tomas Kotal <tomas.kotal@gmail.com>
Message-ID <mailman.2843.1362409932.2939.python-list@python.org> (permalink)

Show all headers | View raw


> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 06:31 -0800
  Re: Different behavior with multiprocessing Chris Angelico <rosuav@gmail.com> - 2013-03-05 01:58 +1100
    Re: Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 07:12 -0800
    Re: Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 07:12 -0800
  Re: Different behavior with multiprocessing Tomas Kotal <tomas.kotal@gmail.com> - 2013-03-04 07:35 -0800
    Re: Different behavior with multiprocessing Chris Angelico <rosuav@gmail.com> - 2013-03-05 02:44 +1100

csiph-web