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

Node doesn't pass -v to eval'd script #21674

Closed
steven10172 opened this issue Jul 5, 2018 · 1 comment
Closed

Node doesn't pass -v to eval'd script #21674

steven10172 opened this issue Jul 5, 2018 · 1 comment
Labels
cli Issues and PRs related to the Node.js command line interface.

Comments

@steven10172
Copy link

  • Version: v8.9.4
  • Platform: 64-bit Mac (Darwin Kernel Version 15.6.0) && Linux 3.2.45-0.6.wd.865.49.315.metal1.x86_64
  • Subsystem:

Current Behavior:
When eval'ing an inline script (node -e) you can freely pass arguments, but if it's a flag that node understands it will evaluate that flag instead of running the inlined script.

Expected Behavior:
I would expect this behavior to match the behavior of running a non-eval'd script.

Example (inline):

$ node -e "console.log(process.argv)" "test"
[ '/Users/.../.nvm/versions/node/v8.9.4/bin/node', 'test' ]
$ node -e "console.log(process.argv)" -v
v8.9.4

Example (non-inline):

$ node test.js "test"
[ '/Users/.../.nvm/versions/node/v8.9.4/bin/node',
 '/.../test.js',
 'test' ]
$ node test.js -v
[ '/Users/.../.nvm/versions/node/v8.9.4/bin/node',
 '/.../test.js',
 '-v' ]
@vsemozhetbyt vsemozhetbyt added the cli Issues and PRs related to the Node.js command line interface. label Jul 5, 2018
@steven10172
Copy link
Author

Closing as this can be achieved by using --

Example:

$ node -e "console.log(process.argv)" -- "test"
[ '/Users/.../.nvm/versions/node/v8.9.4/bin/node', 'test' ]
$ node -e "console.log(process.argv)" -- -v
v8.9.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issues and PRs related to the Node.js command line interface.
Projects
None yet
Development

No branches or pull requests

2 participants