Skip to content

Commit 9c98af7

Browse files
addaleaxMylesBorins
authored andcommitted
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: #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>
1 parent 280cd96 commit 9c98af7

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/node.cc

+7-5
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,8 @@ void Init(int* argc,
946946
}
947947

948948
if (per_process::cli_options->print_v8_help) {
949-
// Doesn't return.
950949
V8::SetFlagsFromString("--help", static_cast<size_t>(6));
951-
UNREACHABLE();
950+
exit(0);
952951
}
953952

954953
*argc = argv_.size();
@@ -1010,13 +1009,16 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) {
10101009
if (per_process::cli_options->print_bash_completion) {
10111010
std::string completion = options_parser::GetBashCompletion();
10121011
printf("%s\n", completion.c_str());
1013-
exit(0);
1012+
result.exit_code = 0;
1013+
result.early_return = true;
1014+
return result;
10141015
}
10151016

10161017
if (per_process::cli_options->print_v8_help) {
1017-
// Doesn't return.
10181018
V8::SetFlagsFromString("--help", static_cast<size_t>(6));
1019-
UNREACHABLE();
1019+
result.exit_code = 0;
1020+
result.early_return = true;
1021+
return result;
10201022
}
10211023

10221024
#if HAVE_OPENSSL

0 commit comments

Comments
 (0)