#2189: hSetBuffer stdin NoBuffering doesn't seem to work in ghc 6.8.2 on Windows
XP
--------------------------------------------+-------------------------------
 Reporter:  FalconNL                        |          Owner:         
     Type:  bug                             |         Status:  new    
 Priority:  normal                          |      Milestone:  6.8.3  
Component:  GHCi                            |        Version:  6.8.2  
 Severity:  normal                          |     Resolution:         
 Keywords:  hsetbuffering buffering buffer  |     Difficulty:  Unknown
 Testcase:                                  |   Architecture:  x86    
       Os:  Windows                         |  
--------------------------------------------+-------------------------------
Comment (by judah):

 There is code in {{{base/cbits/consUtils.c:set_console_buffering}}} to
 disable Windows line buffering (by calling the Win32 function
 `SetConsoleMode`).
 However, the code in `GHC.Handle` which is supposed to call that function
 was `#ifdef`'ed out on mingw in the following commit:

 http://cvs.haskell.org/cgi-
 bin/cvsweb.cgi/fptools/libraries/base/GHC/Handle.hs#rev1.14

 From the comments in `System.Posix.Internals`:
 {{{
 -- 'raw' mode for Win32 means turn off 'line input' (=> buffering and
 -- character translation for the console.) The Win32 API for doing
 -- this is GetConsoleMode(), which also requires echoing to be disabled
 -- when turning off 'line input' processing. Notice that turning off
 -- 'line input' implies enter/return is reported as '\r' (and it won't
 -- report that character until another character is input..odd.) This
 -- latter feature doesn't sit too well with IO actions like IO.hGetLine..
 }}}

 I'm not that experienced with Windows programming, but maybe instead of
 changing the `ConsoleMode`, we could call the lower-level
 `ReadConsoleInput/PeekConsoleInput` when we want to read only one
 character at a time.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2189#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to