Skip to content

Commit

Permalink
src: exit explicitly after printing V8 help
Browse files Browse the repository at this point in the history
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: #34135
Co-authored-by: Ulan Degenbaev <ulan@chromium.org>

PR-URL: #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>
  • Loading branch information
addaleax authored and MylesBorins committed Jul 16, 2020
1 parent 280cd96 commit 9c98af7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,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();
Expand Down Expand Up @@ -1010,13 +1009,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
Expand Down

0 comments on commit 9c98af7

Please sign in to comment.