diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 96c338f86bb..eec6eb8303b 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -331,7 +331,7 @@ Error OS_Unix::execute(const String &p_path, const List &p_arguments, bo int status; waitpid(pid, &status, 0); if (r_exitcode) { - *r_exitcode = WEXITSTATUS(status); + *r_exitcode = WIFEXITED(status) ? WEXITSTATUS(status) : status; } } else {