You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exit code relay fails when run command is a script #6801
I am on the latest stable Poetry version, installed using a recommended method.
I have searched the issues of this repo and believe that this is not a duplicate.
I have consulted the FAQ and blog for any relevant entries or release notes.
If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.
Issue
Hi there,
When using poetry run to run a script defined in the scripts section of pyproject.toml the exit code of the script is not relayed as the final exit code of poetry itself. I originally noticed #5773 and #2369 and was wondering why it wasn't working for me.
It looks like #4456 did not fix #2369 because these are different execution paths. Looking at commands/run.py, running a script (as defined in pyproject.toml) is a different execution path than running non-scripts. As mentioned in #2369, I believe the fix would be:
I made this change locally and it fixed this issue for me.
Alternatively, I believe another fix would be removing the RunCommand.run_script special-case code. Since poetry knows where the script is ($VIRTUALENV/bin/), it could include this directory in the $PATH when executing the command. poetry would then execute the script generated by builders/editable.py.
There may be reasons these two code paths are distinct that I don't understand, but if they can be unified to a single path that would ease maintenance burden and help alleviate situations like this where one path is updated but the other is forgotten.
Activity
dimbleby commentedon Oct 14, 2022
works fine for me, can you put together a reproduction eg in a dockerfile?
dimbleby commentedon Oct 14, 2022
oh I see, you don't mean that the exit code is not relayed, you mean that the return code is not relayed, as an exit code.
(Apologies if this seems pedantic, but this is what confused me)
I expect an MR would be welcome, either of the approaches that you suggest sounds reasonable.
Fixes python-poetry#6801, relay exit code when running script
Fixes python-poetry#6801, relay exit code when running script
Fixes python-poetry#6801, relay exit code when running script
github-actions commentedon Mar 1, 2024
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.