-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
Comments
Actually sorry this is a fault with λ .\node_modules\.bin\ts-node index.ts "C:\Program Files"
[ 'C:\\Program Files' ] |
Ts-node doesn't do this. We get process.argv just like any other CLI
module installed via npm.
The problem lies with the .cmd shim emitted by npm, and with Windows' shell.
…On Tue, Nov 24, 2020, 1:43 AM ArkadyDR ***@***.***> wrote:
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.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1162>, or unsubscribe
<https:/notifications/unsubscribe-auth/AAC35OEFH7AZKZEIN3VEYXLSRNITPANCNFSM4UAMNDDQ>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
Expected Behavior
Actual Behavior
(note ts-node split the string into two args)
Steps to reproduce the problem
See above.
Minimal reproduction
See above.
Specifications
Operating system and version (If Windows, are you using WSL or WSL2?):
The text was updated successfully, but these errors were encountered: