From 9fdd52addea5b2e8a5eca1f79b58019e5578b855 Mon Sep 17 00:00:00 2001 From: ibrahim Date: Wed, 22 Oct 2025 18:09:35 +0800 Subject: [PATCH] FIX(cli, server): Proper exit code handling --- src/mumble/main.cpp | 6 ++++-- src/murmur/main.cpp | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index cec011945..274ce9dbd 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -213,6 +213,7 @@ extern HWND mumble_mw_hwnd; struct CLIOptions { + int exitCode = 0; bool allowMultiple = false; bool suppressIdentity = false; bool rpcMode = false; @@ -364,7 +365,8 @@ CLIOptions parseCLI(int argc, char **argv) { } else { qInfo("%s", info_stream.str().c_str()); } - options.quit = true; + options.quit = true; + options.exitCode = e.get_exit_code(); } return options; @@ -405,7 +407,7 @@ int main(int argc, char **argv) { CLIOptions options = parseCLI(argc, argv); if (options.quit) { - return 0; + return options.exitCode; } // This argument has to be parsed first, since it's value is needed to create the global struct, diff --git a/src/murmur/main.cpp b/src/murmur/main.cpp index 17096fc69..e0e7f0439 100644 --- a/src/murmur/main.cpp +++ b/src/murmur/main.cpp @@ -193,6 +193,7 @@ void cleanup(int signum) { } struct CLIOptions { + int exitCode = 0; bool quit = false; std::optional< std::string > iniFile; std::optional< std::string > dbDumpPath; @@ -315,6 +316,8 @@ CLIOptions parseCLI(int argc, char **argv) { std::cout << info_stream.str(); } + options.quit = true; + options.exitCode = e.get_exit_code(); } return options; @@ -376,7 +379,7 @@ int main(int argc, char **argv) { #endif CLIOptions cli_options = parseCLI(argc, argv); if (cli_options.quit) - return 0; + return cli_options.exitCode; if (cli_options.printLicense) { #ifdef Q_OS_WIN