Skip to content

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

Closed
@steven10172

Description

@steven10172
  • 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' ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command line interface.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions