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 <[email protected]>

PR-URL: #34136
Reviewed-By: Shelley Vohr <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
  • Loading branch information
addaleax committed Jul 7, 2020
1 parent 2243d79 commit 6bc871f
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 @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6bc871f

Please sign in to comment.