New submission from Kay Hayen <kayha...@gmx.de>:

Hello,

I am the author of the Python compiler Nuitka. It has the ability to 
immediately execute the created executable file. For that I am using "os.execl" 
to immediately replace the compiler and run the freshly created binary instead.

This worked well so far, but as of late, I am also checking the exit codes, and 
it turns out that even for failing programs, the exit code is "0" on Windows, 
even though the compiled binary is exiting with "1".

Investigating further, I made a simple program:

-------
import os
os.execl( "FailingProgram.exe", "lala" )
-------

And it turns out, it's giving me "0", whereas when executed directly 
"FailingProgram.exe" gives "1". Checking %errorlevel% manually that is, my test 
framework uses "subprocess" module and gets "0".

The same code works fine (preserves exit code) under Linux. I didn't find the 
windows specific code responsible for implementing "os.execv" under Win32. I am 
suspecting that somehow "cmd.exe" may not be propagating the error code, but 
for that to confirm I would need pointers.

Thanks in advance,
Kay

----------
components: Library (Lib)
messages: 151304
nosy: kayhayen
priority: normal
severity: normal
status: open
title: The "os.execl" call doesn't give programs exit code
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13792>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to