Merge pull request #62550 from Bromeon/bugfix/cli-version-ok

This commit is contained in:
Rémi Verschelde 2022-06-30 14:36:43 +02:00 committed by GitHub
commit e7197cb6f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -673,6 +673,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
packed_data->add_pack_source(zip_packed_data);
#endif
// Default exit code, can be modified for certain errors.
Error exit_code = ERR_INVALID_PARAMETER;
I = args.front();
while (I) {
#ifdef OSX_ENABLED
@ -688,10 +691,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
show_help = true;
exit_code = OK;
goto error;
} else if (I->get() == "--version") {
print_line(get_full_version_string());
exit_code = OK;
goto error;
} else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
@ -1636,7 +1641,7 @@ error:
OS::get_singleton()->finalize_core();
locale = String();
return ERR_INVALID_PARAMETER;
return exit_code;
}
Error Main::setup2(Thread::ID p_main_tid_override) {