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]>
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
@@ -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();
@@ -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

0 comments on commit 9c98af7

Please sign in to comment.