-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Script execution does not relay exit code #71
Comments
Hi @cwichel, Thanks for the feedback. Something is off here. Poe is meant to propagate the exit code of tasks. When I try an example like your on macOS it works as you would expect. I would like to determine what's going on here and get to a fix if possible. Unfortunately I don't have easy access to a windows dev environment to debug with, and my understanding of windows specifics are quite limited, so I'd appreciate if you (or another windows user out there?) could help with investigating this issue. For context the way it's meant to work is that:
Can you think of any reason the that logic would not have the intended result on windows? |
Hey @nat-n It seems that the issue is not coming from poe... Doing some testing shows that, at least on my machine, running the command with poetry is returning the incorrect error code. I've included a print of the command on L153 here: poethepoet/poethepoet/executor/base.py Lines 151 to 154 in e9cabc3
And it returns: > poe test-script
('C:\\Tools\\Miniconda3\\Scripts\\poetry.EXE', 'run', 'python', '-c', "import sys; from os import environ; from importlib import import_module; sys.argv = ['test-script']; sys.path.append('src');\nimport_module('sample.tests').test_script()")
> echo %errorlevel%
0 If I try to execute the line directly using python (no poetry run): > python -c "import sys; from os import environ; from importlib import import_module; sys.argv = ['test-script']; sys.path.append('src'); import_module('sample.tests').test_script()
> echo %errorlevel%
1 But using poetry... > poetry run python -c "import sys; from os import environ; from importlib import import_module; sys.argv = ['test-script']; sys.path.append('src'); import_module('sample.tests').test_script()
> echo %errorlevel%
0 So it seems that the issue needs to go there 😄 As a separate topic... why did you include a line jump on L56 in 1. (just to know)? |
Thanks for investigating @cwichel That's a pity. I guess the solution would be either to try get a fix into poetry (which could take a while with poetry's release rate), or to stop using The new line on L56 is necessary in case of passing CLI arguments to the python function. When this happens For now I'll leave this open as a bug. |
@nat-n hello again! First test: Poetry v1.1.13
First test: Poetry v1.2.0b2
I imagine that this must be related to the new capabilities added to poetry and the adjustment to their backend to achieve them (for example, the new plugin system). Also, I assume that this is not a priority for POE until the v1.2 of poetry gets actually released... |
Curious indeed. Only thing I can think of is that somehow poe being picked up as a plugin for poetry somehow changes the way poetry runs stuff in general?! Thanks for investigating. Lets keep an eye on this. |
Hi @cwichel, could you be so kind as to confirm whether this is still an issue with poetry >= 1.2.0b3 ? |
Hey @nat-n! I've performed the same steps shown in my comment from June 10th, but changed the poetry version to |
@nat-n hey! I've performed the same test steps today using:
And it's working now! > poetry run python -c "import sys; sys.exit(13)"
> echo %errorlevel%
13 |
@cwichel awesome, thanks for reporting back! case closed then. |
Environment
Issue
If you have a script that returns an error as system exit code, for example:
In a file called
sample.py
in your repository root, and configured as follows on thepyproject.toml
file:You'll see (windows):
Instead of:
Is this intended? Is there a way to relay the returncode from the failed script out of poe?
The text was updated successfully, but these errors were encountered: