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