Wrong exist status for os.system, os.poepen, etc.

PAolo paolopantaleo at gmail.com
Tue Mar 6 11:01:58 EST 2007


On 6 Mar, 16:51, "Paul Boddie" <p... at boddie.org.uk> wrote:
> On 6 Mar, 16:39, "Paolo Pantaleo" <paolopanta... at gmail.com> wrote:
>
>
>
> > The os.system() (but all the other funciont with similar behavior) reports
> > wrong exit status. I can reproduce the bug in the following way
>
> I think you should look at some previous threads related to this
> (obtained by searching Google Groups for "os.system exit status
> code"):
>
> "grabbing return codes from os.system() call"http://groups.google.com/group/comp.lang.python/browse_frm/thread/efe...
>
> "please help me understand os.system() result"http://groups.google.com/group/comp.lang.python/browse_frm/thread/4a9...
>
> "os.system() << 8 ?"http://groups.google.com/group/comp.lang.python/browse_frm/thread/f12...
>
> In short, the returned code is actually a combination of two values,
> and you need to extract the expected status code by shifting the
> result 8 bits to the right. It may actually be more complicated than
> that, but the man page for system ("man 3 system") explains this in
> more detail.
>
> Paul

Sorry, for the mistake, I just missed the words "encoded in the format
specified for wait()" in the documentation of popen()

Thnx for the immediate answer
PAolo




More information about the Python-list mailing list