diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-24 01:15:06 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-24 01:15:06 +0100 |
commit | f49efbe0e58594260b768aaa9394abdc16122754 (patch) | |
tree | d151ce86175df004d0b6b7dff9e9e5ef7311cc7e /platform/web/web_main.cpp | |
parent | cd4e4c0fccfdbfe04d91617a1bc6c4785dd6a1ec (diff) | |
parent | 023dcd44c1e628bb654b5472418d6a346b510a71 (diff) | |
download | redot-engine-f49efbe0e58594260b768aaa9394abdc16122754.tar.gz |
Merge pull request #89229 from akien-mga/main-refactor-os-exit-code
Refactor OS exit code to be `EXIT_SUCCESS` by default
Diffstat (limited to 'platform/web/web_main.cpp')
-rw-r--r-- | platform/web/web_main.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/platform/web/web_main.cpp b/platform/web/web_main.cpp index ad2a801881..04513f6d57 100644 --- a/platform/web/web_main.cpp +++ b/platform/web/web_main.cpp @@ -109,24 +109,22 @@ extern EMSCRIPTEN_KEEPALIVE int godot_web_main(int argc, char *argv[]) { // Proper shutdown in case of setup failure. if (err != OK) { - int exit_code = (int)err; - if (err == ERR_HELP) { - exit_code = 0; // Called with --help. - } - os->set_exit_code(exit_code); // Will only exit after sync. emscripten_set_main_loop(exit_callback, -1, false); godot_js_os_finish_async(cleanup_after_sync); - return exit_code; + if (err == ERR_HELP) { // Returned by --help and --version, so success. + return EXIT_SUCCESS; + } + return EXIT_FAILURE; } - os->set_exit_code(0); main_started = true; // Ease up compatibility. ResourceLoader::set_abort_on_missing_resources(false); - Main::start(); + int ret = Main::start(); + os->set_exit_code(ret); os->get_main_loop()->initialize(); #ifdef TOOLS_ENABLED if (Engine::get_singleton()->is_project_manager_hint() && FileAccess::exists("/tmp/preload.zip")) { @@ -140,5 +138,5 @@ extern EMSCRIPTEN_KEEPALIVE int godot_web_main(int argc, char *argv[]) { // We are inside an animation frame, we want to immediately draw on the newly setup canvas. main_loop_callback(); - return 0; + return os->get_exit_code(); } |