FIX(cli, server): Proper exit code handling

This commit is contained in:
ibrahim 2025-10-22 18:09:35 +08:00
parent 0d67afd3f8
commit 9fdd52adde
2 changed files with 8 additions and 3 deletions

View File

@ -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,

View File

@ -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