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 --- scene/main/scene_tree.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scene/main') diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 8bcff4409f..c93306dec8 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -54,6 +54,7 @@ #include "window.h" #include +#include void SceneTreeTimer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_time_left", "time"), &SceneTreeTimer::set_time_left); @@ -538,6 +539,9 @@ void SceneTree::quit(int p_exit_code) { // Override the exit code if a positive argument is given (the default is `-1`). // This is a shorthand for calling `set_exit_code()` on the OS singleton then quitting. OS::get_singleton()->set_exit_code(p_exit_code); + } else if (!OS::get_singleton()->is_custom_exit_code()) { + // Must customize exit code, otherwise it will default to a non-zero value + OS::get_singleton()->set_exit_code(EXIT_SUCCESS); } _quit = true; -- cgit v1.2.3