-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix: RunCommand calling scripts with incorrect executable path #1001
Conversation
Fixes python-poetryGH-965 Calling `sys.argv` should run the same program as the currently running program. To make calling Poetry scripts through RunCommand match this behavior, we must set `sys.argv[0]` to be the full path of the executable. This change makes the behavior of calling a script through `poetry run` the same as calling a script directly from the .venv/bin.
There are probably cleaner ways to test the CLI, so let me know.
My test is hacky. Any tips on cleaning it up would be appreciated. |
@sdispater This is ready for review |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still something I'd like to fix in poetry. I'll fix the conflicts when I get a commitment that this will be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your contribution! 👍
Could you please rebase on the current master branch?
full_path_args = list(args) | ||
full_path_args[0] = self.env._bin(full_path_args[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't we simplify it with
args[0] = self.env._bin(args[0])
instead?
Hello ! I just ran into this issue, is there still no plan to merge this ? |
@chdsbd are you still interested in bringing this to Poetry? if so, please merge the master branch to your code and resolve potential issues. This would allow for rereview. |
Any updates? This would be very nice if this issue was fixed.. |
If desired, I can work on resolve the conflicts and address the issues. @chdsbd are you okay if I rebase your work on another branch? (I will keep the authorship of your commits) |
@wagnerluis1982 Thank you. That would be great! |
@finswimmer could you close this PR in favor of #6737? |
Superseded by #6737 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes GH-965
Calling
sys.argv
should run the same program as the currently running program. To make calling Poetry scripts through RunCommand match this behavior, we must setsys.argv[0]
to be the full path of the executable.This change makes the behavior of calling a script through
poetry run
the same as calling a script directly from the .venv/bin.Pull Request Check List
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!
Note: If your Pull Request introduces a new feature or changes the current behavior, it should be based
on the
develop
branch. If it's a bug fix or only a documentation update, it should be based on themaster
branch.If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!