================
@@ -993,6 +996,20 @@ class IOHandlerProcessSTDIOWindows : public IOHandler {
       case WAIT_FAILED:
         goto exit_loop;
       case WAIT_OBJECT_0: {
+        if (isConsole) {
+          INPUT_RECORD inputRecord;
+          DWORD numRead = 0;
+          if (!PeekConsoleInput(hStdin, &inputRecord, 1, &numRead) ||
+              numRead == 0)
+            goto exit_loop;
+          // We only care about text input. Ignore all non text input events 
and
+          // let other IOHandlers handle them.
+          if (inputRecord.EventType != KEY_EVENT ||
+              !inputRecord.Event.KeyEvent.bKeyDown ||
+              inputRecord.Event.KeyEvent.uChar.AsciiChar == 0)
+            break;
----------------
Nerixyz wrote:

It does fix the issue, but LLDB is now in a busy-loop while the process is 
running and waiting for input (e.g. from `std::cin`). You can see this when 
inspecting LLDB in Task Manager or Process Explorer.

> I think that we should merge this and cherry-pick it to `22.0` and do some 
> proper refactoring on main if need be.

Not sure if we should do it as-is because of the above. If this can be fixed, 
we should definitely cherry-pick it.

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