mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-10 22:02:37 +02:00
Command line arguments '--version' and '--help' return exit code 0 instead of 255
Allows to detect whether those commands executed successfully, which makes integration with shell scripts/CI/bindings straightforward. (cherry picked from commit e3a8edf536ab8115594b0d6c3efa0603e71825ad)
This commit is contained in:
parent
e037bd3bb6
commit
bfdfdac24b
@ -470,6 +470,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||||||
packed_data->add_pack_source(zip_packed_data);
|
packed_data->add_pack_source(zip_packed_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Default exit code, can be modified for certain errors.
|
||||||
|
Error exit_code = ERR_INVALID_PARAMETER;
|
||||||
|
|
||||||
I = args.front();
|
I = args.front();
|
||||||
while (I) {
|
while (I) {
|
||||||
#ifdef OSX_ENABLED
|
#ifdef OSX_ENABLED
|
||||||
@ -486,10 +489,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
|
if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
|
||||||
|
|
||||||
show_help = true;
|
show_help = true;
|
||||||
|
exit_code = OK;
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
} else if (I->get() == "--version") {
|
} else if (I->get() == "--version") {
|
||||||
print_line(get_full_version_string());
|
print_line(get_full_version_string());
|
||||||
|
exit_code = OK;
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
} else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
|
} else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
|
||||||
@ -1302,7 +1307,7 @@ error:
|
|||||||
OS::get_singleton()->finalize_core();
|
OS::get_singleton()->finalize_core();
|
||||||
locale = String();
|
locale = String();
|
||||||
|
|
||||||
return ERR_INVALID_PARAMETER;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error Main::setup2(Thread::ID p_main_tid_override) {
|
Error Main::setup2(Thread::ID p_main_tid_override) {
|
||||||
|
Loading…
Reference in New Issue
Block a user