From 0e4abcb77f6b5ce81824462706f8b2325bc3fed1 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Thu, 21 May 2020 18:08:48 +0200 Subject: Fix Godot returned status code on unexpected error --- core/os/os.cpp | 5 +++++ core/os/os.h | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'core/os') diff --git a/core/os/os.cpp b/core/os/os.cpp index 182bab4058..8af141ef2f 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -226,6 +226,11 @@ int OS::get_exit_code() const { void OS::set_exit_code(int p_code) { _exit_code = p_code; + _is_custom_exit_code = true; +} + +bool OS::is_custom_exit_code() { + return _is_custom_exit_code; } String OS::get_locale() const { diff --git a/core/os/os.h b/core/os/os.h index 77a54ba68a..a740a23617 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -40,6 +40,7 @@ #include "core/templates/vector.h" #include +#include class OS { static OS *singleton; @@ -53,7 +54,8 @@ class OS { bool _debug_stdout = false; String _local_clipboard; bool _no_window = false; - int _exit_code = 0; + int _exit_code = EXIT_FAILURE; // unexpected exit is marked as failure + bool _is_custom_exit_code = false; int _orientation; bool _allow_hidpi = false; bool _allow_layered = false; @@ -268,6 +270,7 @@ public: virtual int get_exit_code() const; virtual void set_exit_code(int p_code); + virtual bool is_custom_exit_code(); virtual int get_processor_count() const; -- cgit v1.2.3