Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Issue when passing a parameter with the & character to a npm cli package from PowerShell on Windows #20699

Open
@ExE-Boss

Description

@ExE-Boss

I'm opening this issue because:

  • npm is crashing.
  • npm is producing an incorrect install.
  • npm is doing something I don't understand.
  • npm is producing incorrect or undesirable behavior.
  • Other (see below for feature requests):

What's going wrong?

PowerShell can’t properly pass string arguments containing the & symbol to Windows Command Prompt scripts, if the string containing the ampersand doesn’t have spaces, due to how the cmd prompt parses the & as a command delimiter, even in a string.

How can the CLI team reproduce the problem?

The following PowerShell log demonstrates the issue:

PS C:\> echo-cli 'https://example.com/?a=1&b=2'
https://example.com/?a=1
'b' is not recognized as an internal or external command,
operable program or batch file.

I’m providing a fix in npm/cmd-shim#27.

PowerShell log with said fix applied:

PS C:\> echo-cli 'https://example.com/?a=1&b=2'
https://example.com/?a=1&b=2

supporting information:

This happens on both PowerShell 6 and Windows PowerShell 5.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions