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] npx loses quotations in command line arguments #2425

Closed
highmtworks opened this issue Dec 30, 2020 · 2 comments · Fixed by #2448
Closed

[BUG] npx loses quotations in command line arguments #2425

highmtworks opened this issue Dec 30, 2020 · 2 comments · Fixed by #2448
Assignees
Labels
Bug thing that needs fixing platform:windows is Windows-specific Release 7.x work is associated with a specific npm 7 release

Comments

@highmtworks
Copy link

Current Behavior:

package.json

{
  "scripts": {
    "start": "ts-node index.ts"
  },
  "devDependencies": {
    "@types/node": "^14.14.16",
    "ts-node": "^9.1.1",
    "typescript": "^4.1.3"
  }
}

index.ts

console.log(process.argv.slice(2))

then,

npx ts-node index.ts "a b"

and get

[ 'a', 'b' ]

Expected Behavior:

should print

[ 'a b' ]

In fact,

npm start "a b"

prints

[ 'a b' ]

Steps To Reproduce:

see Current Behavior section.

Environment:

  • OS: OS: Windows 10 Pro 2004 (19041.685)
  • Node: 15.5.0
  • npm: 7.3.0, 6.14.10

#2423 seems related

@highmtworks highmtworks added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Dec 30, 2020
@highmtworks
Copy link
Author

It seems that https://github.com/npm/cli/blob/v7.3.0/lib/exec.js#L147 is the cause.

@leepowelldev
Copy link

Causing issues over on browserslist too: browserslist/browserslist#571

@highmtworks highmtworks changed the title [BUG] npx looses quotations in command line arguments [BUG] npx loses quotations in command line arguments Jan 3, 2021
@wraithgar wraithgar added platform:windows is Windows-specific and removed Needs Triage needs review for next steps labels Jan 6, 2021
@nlf nlf self-assigned this Jan 7, 2021
@isaacs isaacs closed this as completed in 99156df Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing platform:windows is Windows-specific Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants