From 9c98af71db0fc715c40d4c4347923b2f767a795a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 30 Jun 2020 19:05:24 +0200 Subject: [PATCH] src: exit explicitly after printing V8 help MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: https://github.com/nodejs/node/pull/34135 Co-authored-by: Ulan Degenbaev PR-URL: https://github.com/nodejs/node/pull/34136 Reviewed-By: Shelley Vohr Reviewed-By: Richard Lau Reviewed-By: Daniel Bevenius Reviewed-By: Gireesh Punathil Reviewed-By: Michaƫl Zasso --- src/node.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/node.cc b/src/node.cc index 1c776c79fc6887..c2befefefd8130 100644 --- a/src/node.cc +++ b/src/node.cc @@ -946,9 +946,8 @@ void Init(int* argc, } if (per_process::cli_options->print_v8_help) { - // Doesn't return. V8::SetFlagsFromString("--help", static_cast(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(6)); - UNREACHABLE(); + result.exit_code = 0; + result.early_return = true; + return result; } #if HAVE_OPENSSL