Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows incorrect process status code (4294967295) #5480

Closed
arossert opened this issue Jan 17, 2021 · 2 comments · Fixed by #5481
Closed

Windows incorrect process status code (4294967295) #5480

arossert opened this issue Jan 17, 2021 · 2 comments · Fixed by #5481

Comments

@arossert
Copy link
Contributor

When running an executable compiled with PyInstaller the return code of unhandled exception is changed from 1 to 4294967295 (which probably means -1).

It is pretty easy to reproduce, this is my code:

error.py:

raise Exception("ERROR")

Now just build with pyinstaller error.py

And running this with:

p = subprocess.Popen([sys.executable, "error.py"], stderr=subprocess.PIPE, stdout=subprocess.PIPE)

p.communicate()

print(p.returncode)

p = subprocess.Popen([r"dist\error\error.exe"], stderr=subprocess.PIPE, stdout=subprocess.PIPE)

p.communicate()

print(p.returncode)

Output:

1
4294967295

Running with python return 1 as the returncode and with pyinstaller 4294967295.

PyInstaller: 4.2
OS: Windows
Python: 3.7.9

This only happens in windows, is this expected?

rokm added a commit to rokm/pyinstaller that referenced this issue Jan 17, 2021
Keep the bootloader's return code consistent with that of python
interpreter, which returns 1 if it exits due to exception in the
python script.

Fixes pyinstaller#5480.
@rokm
Copy link
Member

rokm commented Jan 17, 2021

You're right, the return code behavior is not consistent with that of python interpreter and unfrozen script.

But this is not limited to Windows - it also happens on linux, where the return code of frozen program is 255 (0xFF), as opposed to 0xFFFFFFFF on Windows.

@arossert
Copy link
Contributor Author

arossert commented Jan 18, 2021

@rokm you are correct, I also tested it on MacOS and it is the same, the return code is changed from 1 to 255.
Is this the expected behavior?

I now saw the PR to fix this 👍

Legorooj pushed a commit that referenced this issue Jan 27, 2021
…ption (#5481)

Keep the bootloader's return code consistent with that of python
interpreter, which returns 1 if it exits due to exception in the
python script.

Fixes #5480.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants