preemptive getLine on cygwin?

Claus Reinke claus.reinke@talk21.com
Mon, 11 Aug 2003 16:19:54 +0100


I seem to have some problems understanding preemptive getLine 
behaviour on cygwin, and wonder whether this is a known/fixed 
bug/feature (I haven't switched to ghc-6.. yet), or whether anyone 
has experience with this (behaviour on solaris, with an even older 
ghc is more or less as expected).

Claus

-- consider the following example. compile, run, and whenever the
-- program waits for input, enter the next natural number, starting
-- from 1. note that the program preempts the first input and may
-- or may not accept input after the second output..

module Main where
import IO

main = do
  hGetBuffering stdin >>= print
  hGetLine stdin >>= print 
  hGetLine stdin >>= print 

------- win98, cygwin

$ ./Getline
LineBuffering

""
1
"1"

$ cat | ./Getline
BlockBuffering Nothing
1
"1"
2
"2"
3

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 5.04.2


------- solaris

$ ./GetLine
LineBuffering
1
"1"
2
"2"
$ cat | ./GetLine
BlockBuffering Nothing
1
"1"
2
"2"
3
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 5.02.3