From 3778602d53c2bb97f18fcf33d4eec444064d4f32 Mon Sep 17 00:00:00 2001 From: moe li Date: Wed, 27 May 2026 02:51:31 +0800 Subject: [PATCH] exclude the 4kB buffer when Process API is not available --- src/rcore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 0d2dbba3f..8747beb54 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -4602,14 +4602,14 @@ RLAPI int WaitProcess(Process process) RLAPI const char *ReadProcessOutput(Process process, int *length) { - static char output[4096] = { 0 }; - if (process.pid <= 0) { return NULL; } #if defined(_WIN32) + static char output[4096] = { 0 }; + // Read from output pipe // ReadFile will block if there is no data, so call PeekNamedPipe to check for data before reading @@ -4631,6 +4631,8 @@ RLAPI const char *ReadProcessOutput(Process process, int *length) *length = (int)bytesRead; return output; #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__) + static char output[4096] = { 0 }; + struct pollfd fds[1]; fds[0].fd = process.processData->pipefdStdout[0]; fds[0].events = POLLIN;