Skip to content

[BUG] Regression: no way to pass through extra arguments as they are #5004

Closed
npm/run-script
#78
@connectdotz

Description

@connectdotz

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

We have been passing a path-like regex string as the extra argument for the run script, and it worked for npm/yarn on all platforms. But lately, some of our npm users on windows started to report the regex has been incorrectly escaped. Seems like in npm 6.x these arguments are just pass-through, i.e. no manipulation by npm; but this seems to have changed since 7.x.

To demonstrate, here is a simple echo command to echo the arguments receive from npm:

  • echo.bat:
echo %*
  • package.json:
"scripts": {
    "echo": ".\\echo.bat"
},
  • npm 6.14.16
PS C:\whatever> npm run echo -- "c:\\abc\\file\.ts"

> [email protected] echo C:\whatever
> .\echo.bat "c:\\abc\\file\.ts"


C:\whatever>echo "c:\\abc\\file\.ts"
"c:\\abc\\file\.ts"
  • npm 8.5.0/8.12.1
PS C:\whatever> npm run echo -- "c:\\abc\\file\.ts"

> [email protected] echo
> .\echo.bat "c:\\\\abc\\\\file\\.ts"


C:\whatever>echo "c:\\\\abc\\\\file\\.ts"
"c:\\\\abc\\\\file\\.ts"

Expected Behavior

Expect the npm 6.x behavior or something equivalent, so we can continue to pass through arguments.

There are a few similar issues like #3680, #4873 but wanted to make sure that we are not looking for solutions to "escape" it right, simply to just pass-through these arguments like it was in 6.x

Steps To Reproduce

see above

Environment

  • npm: 8.5.0
  • Node.js: 16.14.2
  • OS Name: windows 10
  • System Model Name:
  • npm config:
; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\vsun\github\open-source\vscode-jest-samples\packages\react-js
; HOME = C:\Users\vsun
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingPriority 1high priority issueRelease 8.xwork is associated with a specific npm 8 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions