================
@@ -993,6 +996,27 @@ class IOHandlerProcessSTDIOWindows : public IOHandler {
       case WAIT_FAILED:
         goto exit_loop;
       case WAIT_OBJECT_0: {
+        if (isConsole) {
+          while (true) {
+            INPUT_RECORD inputRecord;
+            DWORD numRead = 0;
+            if (!PeekConsoleInput(hStdin, &inputRecord, 1, &numRead) ||
+                numRead == 0)
+              goto exit_loop;
----------------
Nerixyz wrote:

With [`4a6e017` (this 
PR)](https://github.com/llvm/llvm-project/pull/175812/commits/4a6e01771e9c7b3081dfa8f6d4b69e01e5397e98),
 we'd try to read one record afterward (would block, because zero are in 
there). I think you still need a `if (nRead == 0) goto outer_loop;` or similar 
before checking the `inputRecord`. 

We shouldn't continue with the current iteration of the outer loop (i.e. we 
shouldn't call `ReadFile`), because we know that the console doesn't have any 
pending events - we should wait for new ones.

https://github.com/llvm/llvm-project/pull/175812
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to