python-poetry / python-poetry/poetry

In windows poetry should return exit code Uint32 (permit over 255)

Open
#3,725 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

In Windows, many installer or packaging deployment system (like Microsoft SCCM) relies on exit code which is over255.

Reference
Different Behavior between python app.py and poetry run python app.py
  • python returns exit code as it is to os.
  • poetry run python returns exit code limit to max 255.
How to reproduce

I made helloExit.exe which returns exit code 6501 .
and getExitCode.py like below.

import subprocess

completedProc = subprocess.run('./helloExit.exe')

# Print the exit code.
print("Exit Code: " + str( completedProc.returncode))

exit (completedProc.returncode)

Test Result

$ python getExitCode.py
Do some work
Do some cleanup
Exit Code: 6501

$ echo %ERRORLEVEL%
6501

$ poetry run python getExitCode.py
Do some work
Do some cleanup
Exit Code: 6501

$ echo %ERRORLEVEL%
255

WorkAround

Obviously, poetry should return exit code compatible with os (windows).
But, for a while, if someone need get exit code over 255, I guess they could follow below steps.

  • let poetry make every package dependency.
  • make venv in project using poetry config --local virtualenvs.in-project true
  • activate venv with shell command ( .venv\Scripts\activate.* )
  • use python start_app.py

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior with the provided helloExit.exe and getExitCode.py examples, comparing direct Python execution with poetry run. Trace the poetry run entry point that forwards subprocess exit codes and verify that the Windows result preserves 6501 rather than limiting it to 255.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.