preemptive getLine on cygwin?

Claus Reinke
Tue, 12 Aug 2003 12:44:11 +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).
>You're running a fairly old version of GHC.  With 5.04.3 here I get
>different behaviour, although strangely it seems that stdin and stdout
>don't default to LineBuffering in a cygwin shell window.

So that's a third variant of runtime behaviour, then, for the same 
trivial program (probably cygwin on a more modern windows?)!? 

What do other GHC versions say? And, more importantly, what 
_should_ they do? Strangely, with Blockbuffering the program
seems to be slightly better behaved than with LineBuffering in 
cygwin, so the "cat"-hack helps a bit ("strangely", because I'm 
reading lines, so I'd usually explicitly set LineBuffering.., and 
"slightly better", because it's still not quite as I would have 

I'd still like to understand what's going on and how to get my 
Haskell programs to behave (this arises in a debugging mode of 
a larger app and means that, at the moment, I can't easily use this 
for debugging, which makes life slightly difficult, but at least it
doesn't seem to cause the bug*..).


* just checked in an ms-dos-console, which works as expected. 
    So it seems that the issue is an interaction of ghc/cygwin?