Make sure stdio handles are in blocking mode

Standard I/O doesn't work well with non-blocking handles, so make sure any pipes are in blocking mode before launching child processes.

Fixes https://github.com/libsdl-org/SDL/issues/10998
This commit is contained in:
Sam Lantinga
2024-10-14 21:45:41 -07:00
parent bb764e3106
commit afee27a530
3 changed files with 31 additions and 0 deletions

View File

@@ -73,6 +73,14 @@ static bool SetupRedirect(SDL_PropertiesID props, const char *property, HANDLE *
WIN_SetError("DuplicateHandle()");
return false;
}
if (GetFileType(*result) == FILE_TYPE_PIPE) {
DWORD wait_mode = PIPE_WAIT;
if (!SetNamedPipeHandleState(*result, &wait_mode, NULL, NULL)) {
WIN_SetError("SetNamedPipeHandleState()");
return false;
}
}
return true;
}