#4460: Input is not echoed when GHCi is suspended and subsequently brought to
foreground.
-------------------------------+--------------------------------------------
    Reporter:  manzyuk         |        Owner:              
        Type:  bug             |       Status:  new         
    Priority:  normal          |    Milestone:  7.0.2       
   Component:  GHCi            |      Version:  6.12.1      
    Keywords:  suspend         |     Testcase:              
   Blockedby:                  |   Difficulty:              
          Os:  Linux           |     Blocking:              
Architecture:  x86_64 (amd64)  |      Failure:  None/Unknown
-------------------------------+--------------------------------------------

Comment(by igloo):

 The `hSetBuffering stdin NoBuffering` in particular is the problem. After
 suspending and resuming the program, `icanon` has been turned back on. We
 presumably need to set it to what we think it should be when we get a
 `SIGCONT`.

 {{{
 module Main (main) where

 import Control.Monad.Trans
 import System.Console.Haskeline
 import System.Cmd
 import System.IO

 main :: IO ()
 main = do gb 1
           hSetBuffering stdin NoBuffering
           gb 2
           runInputT defaultSettings runCommands
           putStrLn "Leaving."

 runCommands :: InputT IO ()
 runCommands = do liftIO $ gb 3
                  m <- getInputLine "Prompt: "
                  case m of
                      Nothing -> return ()
                      Just x -> do liftIO $ print x
                                   runCommands

 gb :: Int -> IO ()
 gb n = do putStrLn "----------------------------"
           b <- hGetBuffering stdin
           putStrLn ("b " ++ show n ++ " " ++ show b)
           rawSystem "stty" ["-a"]
           return ()
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4460#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