[GHC] #2189: hSetBuffering stdin NoBuffering doesn't work on Windows

GHC ghc-devs at haskell.org
Sat Jan 9 19:54:18 UTC 2016


#2189: hSetBuffering stdin NoBuffering doesn't work on Windows
-------------------------------------+-------------------------------------
        Reporter:  FalconNL          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Core Libraries    |              Version:  6.8.2
      Resolution:                    |             Keywords:  hsetbuffering
                                     |  buffering buffer
Operating System:  Windows           |         Architecture:  x86
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11394            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by bgamari):

 * related:   => #11394


Old description:

> The following program repeats inputted characters until the escape key is
> pressed.
>

> {{{
> import IO
> import Monad
> import Char
>
> main :: IO ()
> main = do hSetBuffering stdin NoBuffering
>           inputLoop
>
> inputLoop :: IO ()
> inputLoop = do i <- getContents
>                mapM_ putChar $ takeWhile ((/= 27) . ord) i
> }}}
>

> Because of the "hSetBuffering stdin NoBuffering" line it should not be
> necessary to press the enter key between keystrokes. This program works
> correctly in WinHugs (sep 2006 version). However, GHC 6.8.2 does not
> repeat the characters until the enter key is pressed. The problem was
> reproduced with all GHC executables (ghci, ghc, runghc, runhaskell),
> using both cmd.exe and command.com on Windows XP Professional.

New description:

 The following program repeats inputted characters until the escape key is
 pressed.


 {{{#!hs
 import IO
 import Monad
 import Char

 main :: IO ()
 main = do hSetBuffering stdin NoBuffering
           inputLoop

 inputLoop :: IO ()
 inputLoop = do i <- getContents
                mapM_ putChar $ takeWhile ((/= 27) . ord) i
 }}}


 Because of the `hSetBuffering stdin NoBuffering` line it should not be
 necessary to press the enter key between keystrokes. This program works
 correctly in WinHugs (sep 2006 version). However, GHC 6.8.2 does not
 repeat the characters until the enter key is pressed. The problem was
 reproduced with all GHC executables (ghci, ghc, runghc, runhaskell), using
 both cmd.exe and command.com on Windows XP Professional.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2189#comment:50>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list