@@ -34,7 +34,8 @@ Mutex cli_options_mutex; |
34 | 34 | std::shared_ptr<PerProcessOptions> cli_options{new PerProcessOptions()}; |
35 | 35 | } // namespace per_process |
36 | 36 |
|
37 | | -void DebugOptions::CheckOptions(std::vector<std::string>* errors) { |
| 37 | +void DebugOptions::CheckOptions(std::vector<std::string>* errors, |
| 38 | + std::vector<std::string>* argv) { |
38 | 39 | #if !NODE_USE_V8_PLATFORM && !HAVE_INSPECTOR |
39 | 40 | if (inspector_enabled) { |
40 | 41 | errors->push_back("Inspector is not available when Node is compiled " |
@@ -64,7 +65,8 @@ void DebugOptions::CheckOptions(std::vector<std::string>* errors) { |
64 | 65 | } |
65 | 66 | } |
66 | 67 |
|
67 | | -void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) { |
| 68 | +void PerProcessOptions::CheckOptions(std::vector<std::string>* errors, |
| 69 | + std::vector<std::string>* argv) { |
68 | 70 | #if HAVE_OPENSSL |
69 | 71 | if (use_openssl_ca && use_bundled_ca) { |
70 | 72 | errors->push_back("either --use-openssl-ca or --use-bundled-ca can be " |
@@ -91,14 +93,16 @@ void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) { |
91 | 93 | use_largepages != "silent") { |
92 | 94 | errors->push_back("invalid value for --use-largepages"); |
93 | 95 | } |
94 | | - per_isolate->CheckOptions(errors); |
| 96 | + per_isolate->CheckOptions(errors, argv); |
95 | 97 | } |
96 | 98 |
|
97 | | -void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors) { |
98 | | - per_env->CheckOptions(errors); |
| 99 | +void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors, |
| 100 | + std::vector<std::string>* argv) { |
| 101 | + per_env->CheckOptions(errors, argv); |
99 | 102 | } |
100 | 103 |
|
101 | | -void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { |
| 104 | +void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors, |
| 105 | + std::vector<std::string>* argv) { |
102 | 106 | if (has_policy_integrity_string && experimental_policy.empty()) { |
103 | 107 | errors->push_back("--policy-integrity requires " |
104 | 108 | "--experimental-policy be enabled"); |
@@ -169,15 +173,13 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { |
169 | 173 | if (watch_mode) { |
170 | 174 | if (syntax_check_only) { |
171 | 175 | errors->push_back("either --watch or --check can be used, not both"); |
172 | | - } |
173 | | - |
174 | | - if (has_eval_string) { |
| 176 | + } else if (has_eval_string) { |
175 | 177 | errors->push_back("either --watch or --eval can be used, not both"); |
176 | | - } |
177 | | - |
178 | | - if (force_repl) { |
| 178 | + } else if (force_repl) { |
179 | 179 | errors->push_back("either --watch or --interactive " |
180 | 180 | "can be used, not both"); |
| 181 | + } else if (argv->size() < 1 || (*argv)[1].empty()) { |
| 182 | + errors->push_back("--watch requires specifying a file"); |
181 | 183 | } |
182 | 184 |
|
183 | 185 | #ifndef ALLOW_ATTACHING_DEBUGGER_IN_WATCH_MODE |
@@ -222,7 +224,7 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { |
222 | 224 | heap_prof_dir = diagnostic_dir; |
223 | 225 | } |
224 | 226 |
|
225 | | - debug_options_.CheckOptions(errors); |
| 227 | + debug_options_.CheckOptions(errors, argv); |
226 | 228 | #endif // HAVE_INSPECTOR |
227 | 229 | } |
228 | 230 |
|
|