You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are multiple significant issues with spawnWithShell on Windows:
It finds the executable by looking at the string and naively scanning for quotes. This doesn't respect ^-escaped spaces.
This quote-scanning doesn't match types of quotes. For instance, "'my double quoted path'" will open quotes at the first " character and then say the quotes have ended at the ' character.
Finally, the path is passed to which.syncwith the quotes intact. So it's looking for an executable with those quotes in its path.
The isCmd regex searches for \ but / is a legal alternative path separator on windows.
Shell can be passed in. It's not unlikely that, if the user is on Windows, they're using PowerShell. In that case, I don't know what's supposed to happen.
Is there an existing issue for this?
Current Behavior
There are multiple significant issues with
spawnWithShell
on Windows:It finds the executable by looking at the string and naively scanning for quotes. This doesn't respect
^
-escaped spaces.This quote-scanning doesn't match types of quotes. For instance,
"'my double quoted path'"
will open quotes at the first"
character and then say the quotes have ended at the'
character.Finally, the path is passed to
which.sync
with the quotes intact. So it's looking for an executable with those quotes in its path.The
isCmd
regex searches for\
but/
is a legal alternative path separator on windows.Shell can be passed in. It's not unlikely that, if the user is on Windows, they're using PowerShell. In that case, I don't know what's supposed to happen.
Originally reported at npm/cli#6716 (comment)
The text was updated successfully, but these errors were encountered: