Processing (Linux): fix hanging if a child process prints to both stdout and stderr

This commit is contained in:
李通洲
2023-10-31 14:03:24 +08:00
parent c9ef47271a
commit c504096181
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -31,6 +31,7 @@ Bugfixes:
* Detect BSSID instead of Wifi MAC address to align with other platforms (Wifi, macOS)
* Remove support of used GPU memory detection, which is not reliable and only supported with `--gpu-force-vulkan`. (GPU)
* Fix flag `--brightness-ddcci-sleep` (Brightness, Linux)
* Fix hanging if a child process prints to both stdout and stderr (Linux)
Logos:
* Add Black Mesa
+2 -1
View File
@@ -34,10 +34,11 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
//Child
if(childPid == 0)
{
int nullFile = open("/dev/null", O_WRONLY);
dup2(pipes[1], useStdErr ? STDERR_FILENO : STDOUT_FILENO);
dup2(nullFile, useStdErr ? STDOUT_FILENO : STDERR_FILENO);
close(pipes[0]);
close(pipes[1]);
close(useStdErr ? STDOUT_FILENO : STDERR_FILENO);
setenv("LANG", "C", 1);
execvp(argv[0], argv);
exit(901);