Skip to content

hGetBufNonBlocking still blocks on windows

Summary

The hGetBufNonBlocking function still blocks in powershell on windows even if hSetBuffering stdin NoBuffering is used.

Steps to reproduce

PS C:\Users\Jaro> ghci +RTS --io-manager=native
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
ghci> import Foreign.Marshal.Alloc
ghci> import System.IO
ghci> hSetBuffering stdin NoBuffering
ghci> buf <- mallocBytes 100
ghci> hGetBufNonBlocking stdin buf 100

This blocks until I press at least one key (or until a console event happens).

Expected behavior

I expect hGetBufNonBlocking to never block. I don't even really expect to block with other buffering modes. I still need to test how it behaves on Linux, but it should match that behavior.

Environment

  • GHC version used: 9.0.2

Optional:

  • Operating System: Windows 10
  • System Architecture: x86_64
Edited by Jaro Reinders
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information