Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
squash: move flag validation to c++
  • Loading branch information
not-an-aardvark committed Apr 1, 2017
commit fab87a95585dfd4277642bc3883b59a59695813e
4 changes: 0 additions & 4 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@
}

if (process._eval != null && !process._forceRepl) {
if (process._syntax_check_only != null) {
console.error('--check and --eval flags are mutually exclusive.');
process.exit(9);
}
// User passed '-e' or '--eval' arguments to Node without '-i' or
// '--interactive'
preloadModules();
Expand Down
6 changes: 6 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3800,6 +3800,12 @@ static void ParseArgs(int* argc,
}
#endif

if (eval_string != nullptr && syntax_check_only) {
fprintf(stderr,
"%s: either --check or --eval can be used, not both\n", argv[0]);
exit(9);
}

// Copy remaining arguments.
const unsigned int args_left = nargs - index;
memcpy(new_argv + new_argc, argv + index, args_left * sizeof(*argv));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-cli-syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ syntaxArgs.forEach(function(args) {

assert.strictEqual(
c.stderr,
'--check and --eval flags are mutually exclusive.\n'
`${node}: either --check or --eval can be used, not both\n`
);

assert.strictEqual(c.status, 9, 'code === ' + c.status);
Expand Down