1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Added an exit code to the blocking mode of OS::execute

Updated documentation accordingly.

Fixes #31881.
This commit is contained in:
Ruslan Mullayanov
2019-09-07 22:39:24 +05:00
committed by Rémi Verschelde
parent 084481b79d
commit b4c927b514
3 changed files with 7 additions and 4 deletions

View File

@@ -481,15 +481,18 @@ Error _OS::shell_open(String p_uri) {
int _OS::execute(const String &p_path, const Vector<String> &p_arguments, bool p_blocking, Array p_output, bool p_read_stderr) {
OS::ProcessID pid = -2;
int exitcode = 0;
List<String> 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;
}