|
RE: ghc-6 messing with terminal settings?: msg#00003lang.haskell.glasgow.bugs
On 02 July 2004 11:30, Malcolm Wallace wrote: > "Simon Marlow" <simonmar@xxxxxxxxxxxxx> writes: > >>> It would appear that ghc-6 is being careful to save the current >>> state of the terminal at the point of hSetBuffering, and to restore >>> it on exit, something ghc-5 did not do. But paradoxically, this >>> "safer" choice caused things to mess up, instead of getting better! >> >> Your diagnosis is spot on. >> >> I suggest you just remove the 'stty' commands in that code (which >> don't work on Windows, incedentally), and it will do what you want. > > But such a solution will not work in nhc98 or Hugs I suspect. The '98 > Report does not AFAIK specify any particular terminal behaviour for > programs using hSetBuffering, so ghc goes beyond the standard here. > Perhaps all the compilers should follow suit, but that is a discussion > we haven't had yet. Sure - you'll have to use conditional compilation to make this work on all compilers, and indeed all OSs. I tend to think that changing the terminal settings for NonBlocking Handles attached to TTYs is the right thing, because it leads to fewer confused users. Sure the Haskell 98 report doesn't require you to do this, and you can use that as a valid defense. But in the end, you still have to deal with those messages from confused users. GHC has always changed the terminal settings (well, for as long as I remember, anyway). >> Better even: GHC will save and restore the terminal settings, >> whereas your program always sets the terminal to icanon/echo on exit. > > Yes, calling stty was always a bit of a hack anyway. But it > highlights the real lack, which is a a portable library in Haskell > (System.Console.Term?) to give explicit control over these matters. > Alastair Reid suggests something like > > data TTYState = ..... > getTTYState :: IO TTYState > setTTYState :: TTYState -> IO () Perhaps... Cheers, Simon
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: ghc-6 messing with terminal settings?, Malcolm Wallace |
|---|---|
| Next by Date: | Re: ghc-6 messing with terminal settings?, Malcolm Wallace |
| Previous by Thread: | Re: ghc-6 messing with terminal settings?, Malcolm Wallace |
| Next by Thread: | Re: ghc-6 messing with terminal settings?, Malcolm Wallace |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |