Skip to content

[BUG] spawnWithShell is very, very broken on WindowsΒ #73

@rotu

Description

@rotu

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

There are multiple significant issues with spawnWithShell on Windows:

  1. It finds the executable by looking at the string and naively scanning for quotes. This doesn't respect ^-escaped spaces.

  2. 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.

  3. 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.

  4. The isCmd regex searches for \ but / is a legal alternative path separator on windows.

  5. 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds an initial review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions