[ ghc-Bugs-995658 ] hReady always returns True when used on win32 non-Console

SourceForge.net noreply at sourceforge.net
Wed Jul 21 23:00:48 EDT 2004


Bugs item #995658, was opened at 2004-07-21 20:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=995658&group_id=8032

Category: libraries/haskell98
Group: 6.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Will Glozer (wglozer)
Assigned to: Nobody/Anonymous (nobody)
Summary: hReady always returns True when used on win32 non-Console

Initial Comment:
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.              

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=995658&group_id=8032



More information about the Glasgow-haskell-bugs mailing list