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

Parsing of CLI args differs between ts-node and node -r ts-node/register #1162

Closed
ArkadyDR opened this issue Nov 24, 2020 · 2 comments
Closed

Comments

@ArkadyDR
Copy link

On windows, ts-node is splitting quoted CLI args (eg paths) on spaces, different from what node.exe is doing. This impacts CLI tools that are run under npx ts-node.

Sample code

index.ts:

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

Expected Behavior

λ node -r ts-node/register index.ts "C:\Program Files"
[ 'C:\\Program Files' ]

λ npx ts-node index.ts "C:\Program Files"
[ 'C:\\Program Files' ]

Actual Behavior

λ node -r ts-node/register index.ts "C:\Program Files"
[ 'C:\\Program Files' ]

λ npx ts-node index.ts "C:\Program Files"
[ 'C:\\Program', 'Files' ]

(note ts-node split the string into two args)

Steps to reproduce the problem

See above.

Minimal reproduction

See above.

Specifications

  • ts-node version: 9.0.0
  • node version: 14.15.0
  • TypeScript version: 4.1.2
  • tsconfig.json, if you're using one: Not using one

Operating system and version (If Windows, are you using WSL or WSL2?):

  • Windows 10.0.17763 native , in cmd.exe.
@ArkadyDR
Copy link
Author

ArkadyDR commented Nov 24, 2020

Actually sorry this is a fault with npx:

λ .\node_modules\.bin\ts-node index.ts "C:\Program Files"
[ 'C:\\Program Files' ]

(npm/npx#14)

@cspotcode
Copy link
Collaborator

cspotcode commented Nov 24, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants