From 3fe0a52a31f7b8704934d27107bcc9459d17d182 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Fri, 29 Nov 2019 13:11:58 +0100 Subject: [PATCH] Fix #78883: fgets(STDIN) fails on Windows If a character file is detected as pipe, we have to set the Windows only flag `is_pipe_blocking`. --- main/streams/plain_wrapper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index 61b19e48ad0b4..8e4652d5a6d68 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -254,6 +254,9 @@ static void detect_is_pipe(php_stdio_stream_data *self) { DWORD file_type = GetFileType((HANDLE)handle); self->is_pipe = file_type == FILE_TYPE_PIPE || file_type == FILE_TYPE_CHAR; + if (file_type == FILE_TYPE_CHAR) { + self->is_pipe_blocking = 1; + } } #endif }