-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- OS version and name: macOS 10.13
- Poetry version: 0.12.11
- Link of a Gist with the contents of your pyproject.toml file: https://github.com/chdsbd/poetry-repro/blob/master/pyproject.toml
Issue
sys.argv varies when running package through poetry run vs poetry shell
poetry run cli,sys.argv == ['cli']poetry shell && cli,sys.argv == ['/full/path/to/package/.venv/bin/cli']
EDIT: I've looked into this a little bit more and it seems like this RunCommand code is the root of the issue. We are assigning incorrect values to sys.argv for the executable. I believe that sys.argv should be args that, if called, will run the same program as the running program.
poetry shell is going to always work correctly because it doesn't touch Poetry. The virtualenv is added to the path so we're calling directly to the executable in the virtualenv bin.
For the fix, I think we want to lookup the full path to the Poetry script in virtualenv bin and use that executable path as the first arg in sys.argv. I think that should fix this issue and make the behavior of calling scripts through poetry run equal to poetry shell.