You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
OS::execute can now read from stderr too when executing with a pipe.
This commit is contained in:
@@ -330,7 +330,7 @@ uint64_t OS_Unix::get_ticks_usec() const {
|
||||
return longtime;
|
||||
}
|
||||
|
||||
Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode) {
|
||||
Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
|
||||
|
||||
if (p_blocking && r_pipe) {
|
||||
|
||||
@@ -342,7 +342,11 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bo
|
||||
argss += String(" \"") + p_arguments[i] + "\"";
|
||||
}
|
||||
|
||||
argss += " 2>/dev/null"; //silence stderr
|
||||
if (read_stderr) {
|
||||
argss += " 2>&1"; // Read stderr too
|
||||
} else {
|
||||
argss += " 2>/dev/null"; //silence stderr
|
||||
}
|
||||
FILE *f = popen(argss.utf8().get_data(), "r");
|
||||
|
||||
ERR_FAIL_COND_V(!f, ERR_CANT_OPEN);
|
||||
|
||||
Reference in New Issue
Block a user