preemptive getLine on cygwin?

Simon Marlow
Tue, 12 Aug 2003 13:51:19 +0100

> So that's a third variant of runtime behaviour, then, for the same=20
> trivial program (probably cygwin on a more modern windows?)!?=20
> What do other GHC versions say? And, more importantly, what=20
> _should_ they do?

GHC 5.04.3 behaves as I'd expect, except that it defaults to
BlockBuffering for stdin/stdout in a cygwin window.  In a DOS window it
defaults to LineBuffering as expected.  This appears to be because
mingw's implementation of isatty() only detects DOS windows, which is

> Strangely, with Blockbuffering the program
> seems to be slightly better behaved than with LineBuffering in=20
> cygwin, so the "cat"-hack helps a bit ("strangely", because I'm=20
> reading lines, so I'd usually explicitly set LineBuffering.., and=20
> "slightly better", because it's still not quite as I would have=20
> expected).
> I'd still like to understand what's going on and how to get my=20
> Haskell programs to behave (this arises in a debugging mode of=20
> a larger app and means that, at the moment, I can't easily use this=20
> for debugging, which makes life slightly difficult, but at least it
> doesn't seem to cause the bug*..).

I think just upgrading your GHC should fix things.  If not, we'll look
into it.