Fix running console scripts of editable dependencies on Windows#3339
Fix running console scripts of editable dependencies on Windows#3339neersighted merged 5 commits intopython-poetry:masterfrom
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 runto useshell=Truewhen 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 runby only specifying the name of the console script (i.e. without the.cmdextension of the wrapper script file) becauseshell=Truecauses the command to be executed viacmd.exeon Windows which has support for calling.cmdfiles without specifying the.cmdextension.I don't think that adding
shell=Truehere only for Windows should cause any issues. I saw that therun()method on theEnvclass (which calls the_run()private method) already usesshell=Truewhen 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 theEnvclass was so thatpoetry runcould useexecute()to ensure that signals sent topoetryare forwarded correctly to what is executed bypoetry run, but I don't think that addingshell=Trueshould interfere with that goal on Windows.