src: exit explicitly after printing V8 help

V8 will not exit the process after handling --help anymore:
https://chromium-review.googlesource.com/c/v8/v8/+/2276276

As a drive-by fix, correctly return in the `print_bash_completion`
case as well.

Refs: https://github.com/nodejs/node/pull/34135
Co-authored-by: Ulan Degenbaev <ulan@chromium.org>

PR-URL: https://github.com/nodejs/node/pull/34136
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Anna HenningsenandUlan Degenbaev committed 2020-07-07 23:41:20 +02:00
1 parent 2243d79f74
commit 6bc871f470
1 file changed
+7 -5
+7 -5
View File
@@ -939,9 +939,8 @@ void Init(int* argc,
}
if (per_process::cli_options->print_v8_help) {
// Doesn't return.
V8::SetFlagsFromString("--help", static_cast<size_t>(6));
UNREACHABLE();
exit(0);
}
*argc = argv_.size();
@@ -1003,13 +1002,16 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) {
if (per_process::cli_options->print_bash_completion) {
std::string completion = options_parser::GetBashCompletion();
printf("%s\n", completion.c_str());
exit(0);
result.exit_code = 0;
result.early_return = true;
return result;
}
if (per_process::cli_options->print_v8_help) {
// Doesn't return.
V8::SetFlagsFromString("--help", static_cast<size_t>(6));
UNREACHABLE();
result.exit_code = 0;
result.early_return = true;
return result;
}
#if HAVE_OPENSSL