diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-06 18:50:35 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-03-08 23:31:24 +0100 |
commit | 023dcd44c1e628bb654b5472418d6a346b510a71 (patch) | |
tree | 61ae1291ab2b93c2a0de25c4edcc11ee20c3be75 /platform/windows/godot_windows.cpp | |
parent | ffc41fb76df5922321cdd98cce12715a039629b0 (diff) | |
download | redot-engine-023dcd44c1e628bb654b5472418d6a346b510a71.tar.gz |
Refactor OS exit code to be `EXIT_SUCCESS` by default
- `Main::setup` early exits (failure or `--help`/`--version`) now
consistently return `EXIT_FAILURE` or `EXIT_SUCCESS` on all platforms,
instead of 255 on some and a Godot Error code on others.
- `Main::start` now returns the exit code, simplifying the handling of early
failures.
- `Main::iteration` needs to explicit set the exit code in OS if it errors
out.
- Web and iOS now properly return `OS::get_exit_code()` instead of 0.
Diffstat (limited to 'platform/windows/godot_windows.cpp')
-rw-r--r-- | platform/windows/godot_windows.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/platform/windows/godot_windows.cpp b/platform/windows/godot_windows.cpp index f86ecd87fb..5f41b4e568 100644 --- a/platform/windows/godot_windows.cpp +++ b/platform/windows/godot_windows.cpp @@ -171,13 +171,15 @@ int widechar_main(int argc, wchar_t **argv) { delete[] argv_utf8; if (err == ERR_HELP) { // Returned by --help and --version, so success. - return 0; + return EXIT_SUCCESS; } - return 255; + return EXIT_FAILURE; } - if (Main::start()) { + if (Main::start() == EXIT_SUCCESS) { os.run(); + } else { + os.set_exit_code(EXIT_FAILURE); } Main::cleanup(); |