[Lldb-commits] [lldb] [lldb][windows] prevent IOHandlerProcessSTDIOWindows from consuming non text inputs (PR #175812)

via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 19 10:27:27 PST 2026


================
@@ -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:

> I think this should never happen because `WaitForMultipleObjects` means there is data in the pipe right?

If there's no data in the pipe, that's true. But if there are _only_ non-keyboard events in it, we'll read them out and discard them (in the inner loop). Once we drained the pipe, `PeekConsoleInput` will return `nRead = 0`.

https://github.com/llvm/llvm-project/pull/175812


More information about the lldb-commits mailing list