Skip to content

Fix parameter_option returning only the first character of attached values - #538

Open
DSeaStar wants to merge 2 commits into
python-poetry:mainfrom
DSeaStar:fix-parameter-option-equals-value
Open

DSeaStar wants to merge 2 commits into
python-poetry:mainfrom
DSeaStar:fix-parameter-option-equals-value

Conversation

@DSeaStar

Copy link
Copy Markdown

Fixes #434.

ArgvInput.parameter_option() treated an attached value as a single character:

return token[len(leading)]

So --directory=/tmp/foo became / and -C/tmp/foo became /. Space-separated forms (--directory /tmp/foo) already worked because they take the next token.

This is the same slice Symfony uses (substr($token, strlen($leading))). Poetry reads --directory / -C through this helper before the command is fully parsed, which is why poetry run --directory=path python file.py failed while poetry run --directory path python file.py succeeded.

Test plan

  • pytest tests/io/inputs/test_argv_input.py (covers --option=value, -Ovalue, space-separated forms, and run --directory=path)
  • Full pytest tests (one pre-existing TTY decoration failure unrelated to this change)

…alues.

ArgvInput.parameter_option used token[len(leading)] instead of a slice, so
--directory=/tmp/foo and -C/tmp/foo each returned a single character. This
matches Symfony's substr() and unblocks poetry run --directory=path.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poetry run doesn't work with --directory=

2 participants