Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
connectdotz opened this issue Jun 9, 2022 · 2 comments · Fixed by npm/run-script#78
Closed
2 tasks done
Assignees
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@connectdotz
Copy link

connectdotz commented Jun 9, 2022

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"

> vscode-test-cra@0.1.0 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"

> vscode-test-cra@0.1.0 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.
@connectdotz connectdotz added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jun 9, 2022
@ljharb
Copy link
Contributor

ljharb commented Jun 9, 2022

Can you try with npm 8 latest?

@connectdotz
Copy link
Author

hi, upgraded to 8.12.1, same result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants