Skip to content

winio: make console read non blocking not wait for any events

The hGetBufNonBlocking is unused in GHC itself, but at least the documentation suggests it shouldn't ever block.

ReadConsoleInput does block until there's a console event available. Which is fine for consoleRead but not so for consoleReadNonBlocking.

So we just have to check the number of available events before calling ReadConsoleInput.

Fixes #21665 (closed)

Needs a rebase after !8359 (closed)

Note that while I want to write a testcase for this, it's impossible as the testsuite:

  1. runs inside msys2, the stdhandles are pipes then (which is why test don't fail atm)
  2. the handles are redirected by the testsuite to new pipes. So again, won't allow the use of native consoles.
Edited by Tamar Christina

Merge request reports