From 07fde68d524f21b56c9f58af32574c596de8576c Mon Sep 17 00:00:00 2001 From: Justine Tunney Date: Thu, 5 Sep 2024 21:12:48 -0700 Subject: [PATCH] Fix Windows console poll() copy/paste regression --- libc/calls/read-nt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libc/calls/read-nt.c b/libc/calls/read-nt.c index 17750ab0f..daa5680dc 100644 --- a/libc/calls/read-nt.c +++ b/libc/calls/read-nt.c @@ -901,6 +901,11 @@ RestartOperation: } textwindows int CountConsoleInputBytesBlocking(uint32_t ms, sigset_t waitmask) { + int got = CountConsoleInputBytes(); + if (got == -1) + return 0; + if (got > 0) + return got; uint32_t inmode = DisableProcessedInput(); int rc = CountConsoleInputBytesBlockingImpl(ms, waitmask, false); RestoreProcessedInput(inmode);