Use file descriptor I/O for process pipes

Use low level non-blocking I/O for process pipe streams. This may fix issues with data not getting through the pipe occasionally.

Related: https://github.com/libsdl-org/SDL/issues/11006
This commit is contained in:
Sam Lantinga committed 2024-10-04 12:24:17 -07:00
1 parent f592a35439
commit 00385951a1
3 files changed
+171 -26

No files matched your search

+1 -6
View File
@@ -57,12 +57,7 @@ static bool SetupStream(SDL_Process *process, int fd, const char *mode, const ch
// Set the file descriptor to non-blocking mode
fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
FILE *fp = fdopen(fd, mode);
if (!fp) {
return false;
}
SDL_IOStream *io = SDL_IOFromFP(fp, true);
SDL_IOStream *io = SDL_IOFromFD(fd, true);
if (!io) {
return false;
}