getChar (NoBuffering) not working on Windows

Hello list, I am writing a small console application. Today I was bitten by #2189 [1] ("hSetBuffering stdin NoBuffering doesn't work on Windows"). To reproduce: import System.IO main :: IO () main = hSetBuffering stdin NoBuffering >> getChar >>= putChar -- on linux you just need to press, say, 'c', on Win you -- need to press <Enter> too. Is there any sensible (cross-platform) way of working around this? [1] https://ghc.haskell.org/trac/ghc/ticket/2189

On Tue, Jul 18, 2017 at 08:29:27PM +0200, Francesco Ariis wrote:
Hello list,
I am writing a small console application.
Today I was bitten by #2189 [1] ("hSetBuffering stdin NoBuffering doesn't work on Windows"). To reproduce:
[...]
Is there any sensible (cross-platform) way of working around this?
I'll answer myself: http://hackage.haskell.org/package/hidden-char (works with concurrency too).
participants (1)
-
Francesco Ariis