summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeddy Katz <teddy.katz@gmail.com>2017-03-30 02:35:03 -0400
committerTeddy Katz <teddy.katz@gmail.com>2017-04-03 22:07:45 -0400
commita5f91ab230c574d561780b6867d00f06fcc1e4de (patch)
treeb59885d6d52ee74e2a998605c1923e76d0312c57 /src
parent3209a8ebf3aa2587c68c4b72e6c3b93176090807 (diff)
downloadandroid-node-v8-a5f91ab230c574d561780b6867d00f06fcc1e4de.tar.gz
android-node-v8-a5f91ab230c574d561780b6867d00f06fcc1e4de.tar.bz2
android-node-v8-a5f91ab230c574d561780b6867d00f06fcc1e4de.zip
src: throw when -c and -e are used simultaneously
The -c flag ("check script syntax") and -e flag ("evaluate given code") have contradictory meanings. Make them mutually exclusive by throwing when both of them are provided. Fixes: https://github.com/nodejs/node/issues/11680 PR-URL: https://github.com/nodejs/node/pull/11689 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index 853e0aa796..f1a3493bf1 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -3816,6 +3816,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));