From b4c927b514bcc550fb6f8f186219bb181aeeae33 Mon Sep 17 00:00:00 2001 From: Ruslan Mullayanov Date: Sat, 7 Sep 2019 22:39:24 +0500 Subject: Added an exit code to the blocking mode of OS::execute Updated documentation accordingly. Fixes #31881. --- core/bind/core_bind.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 30aaa0e646..d07ba44788 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -481,15 +481,18 @@ Error _OS::shell_open(String p_uri) { int _OS::execute(const String &p_path, const Vector &p_arguments, bool p_blocking, Array p_output, bool p_read_stderr) { OS::ProcessID pid = -2; + int exitcode = 0; List args; for (int i = 0; i < p_arguments.size(); i++) args.push_back(p_arguments[i]); String pipe; - Error err = OS::get_singleton()->execute(p_path, args, p_blocking, &pid, &pipe, NULL, p_read_stderr); + Error err = OS::get_singleton()->execute(p_path, args, p_blocking, &pid, &pipe, &exitcode, p_read_stderr); p_output.clear(); p_output.push_back(pipe); if (err != OK) return -1; + else if (p_blocking) + return exitcode; else return pid; } -- cgit v1.2.3