Skip to content

Commit 6bc871f

Browse files
committed
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 <[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]>
1 parent 2243d79 commit 6bc871f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/node.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -939,9 +939,8 @@ void Init(int* argc,
939939
}
940940

941941
if (per_process::cli_options->print_v8_help) {
942-
// Doesn't return.
943942
V8::SetFlagsFromString("--help", static_cast<size_t>(6));
944-
UNREACHABLE();
943+
exit(0);
945944
}
946945

947946
*argc = argv_.size();
@@ -1003,13 +1002,16 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) {
10031002
if (per_process::cli_options->print_bash_completion) {
10041003
std::string completion = options_parser::GetBashCompletion();
10051004
printf("%s\n", completion.c_str());
1006-
exit(0);
1005+
result.exit_code = 0;
1006+
result.early_return = true;
1007+
return result;
10071008
}
10081009

10091010
if (per_process::cli_options->print_v8_help) {
1010-
// Doesn't return.
10111011
V8::SetFlagsFromString("--help", static_cast<size_t>(6));
1012-
UNREACHABLE();
1012+
result.exit_code = 0;
1013+
result.early_return = true;
1014+
return result;
10131015
}
10141016

10151017
#if HAVE_OPENSSL

0 commit comments

Comments
 (0)