hReady always returns True when used on win32 non-Console
The hReady function always returns True when called on
a stdin stream that is not a real win32 console stream,
even if there is no data available. This causes
blocking of programs that depend on hReady to return
true only when there is at least one character available.
The following program will demonstrate this behavior
when run from inside an msys rxvt window, an emacs
shell buffer, etc:
-------------------------
import IO
import Monad
main = do ready <- hReady stdin
when ready $ do
putStr("stdin is ready\n")
hFlush(stdout)
do c <- getChar
putStr("getChar read '" ++ [c] ++ "'\n")
hFlush(stdout)
getChar
main
-------------------------
I've tested this on Windows XP SP1, using the latest
ghc 6.2.1.
Trac metadata
Trac field |
Value |
Version |
6.2.1 |
Type |
Bug |
TypeOfFailure |
OtherFailure |
Priority |
normal |
Resolution |
ResolvedFixed |
Component |
libraries/haskell98 |
Test case |
|
Differential revisions |
|
BlockedBy |
|
Related |
|
Blocking |
|
CC |
|
Operating system |
|
Architecture |
|