-
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 running console scripts of editable dependencies on Windows #3339
Conversation
@finswimmer can you help me find a reviewer for this PR? |
Any progress on that? Seems like an easy-fix? |
@arzamas500 I have resolved the merge conflicts, but we will need a maintainer to approve the check workflows since this is my first time contributing. |
@finswimmer it's been a few years since I opened this PR and I believe the targeted issues are still present in the latest Poetry release(s). Is there anything I need to do before a maintainer would approve running the remaining PR checks (since I am a first-time contributor) and/or review this PR? |
@kevincon I have approved the run. Will review it in the coming week unless someone else gets to it before me. |
@kevincon how does this change impact non command prompt shells on windows? |
@abn I'm not familiar with any other shells used on Windows besides Command Prompt (but understand they are technically supported by Python via the |
@kevincon how about Powershell? is it fully compatible with CMD? |
@Secrus I don't think Powershell is compatible with I don't think that Powershell not being compatible with |
Per #5773 (comment) I suspect this has broken commands with more than one word. |
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. |
Pull Request Check List
Resolves: #3265
Resolves: #2481
This PR changes
poetry run
to useshell=True
when executing the user-provided command on Windows.This ensures that the CMD wrapper script file that Poetry generates for console scripts of editable dependencies can be called via
poetry run
by only specifying the name of the console script (i.e. without the.cmd
extension of the wrapper script file) becauseshell=True
causes the command to be executed viacmd.exe
on Windows which has support for calling.cmd
files without specifying the.cmd
extension.I don't think that adding
shell=True
here only for Windows should cause any issues. I saw that therun()
method on theEnv
class (which calls the_run()
private method) already usesshell=True
when executing any command on Windows:poetry/poetry/utils/env.py
Lines 1067 to 1068 in 825cf66
I also think I understand from #1236 that the motivation for having a separate
execute()
method from therun()
method on theEnv
class was so thatpoetry run
could useexecute()
to ensure that signals sent topoetry
are forwarded correctly to what is executed bypoetry run
, but I don't think that addingshell=True
should interfere with that goal on Windows.