Commit 0b60725b authored by Simon Marlow's avatar Simon Marlow

Don't put stdin into non-blocking mode (#2778, #2777)

This used to be necessary when our I/O library needed all FDs in
O_NONBLOCK mode, and readline used to put stdin back into blocking
mode.  Nowadays the I/O library can cope with FDs in blocking mode,
and #2778/#2777 show why this is important.
parent 57c3c1dd
...@@ -96,10 +96,6 @@ import GHC.TopHandler ...@@ -96,10 +96,6 @@ import GHC.TopHandler
import Data.IORef ( IORef, readIORef, writeIORef ) import Data.IORef ( IORef, readIORef, writeIORef )
#ifdef USE_EDITLINE
import System.Posix.Internals ( setNonBlockingFD )
#endif
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
ghciWelcomeMsg :: String ghciWelcomeMsg :: String
...@@ -641,11 +637,8 @@ readlineLoop = do ...@@ -641,11 +637,8 @@ readlineLoop = do
return (Just str) return (Just str)
withReadline :: IO a -> IO a withReadline :: IO a -> IO a
withReadline = bracket_ stopTimer (do startTimer; setNonBlockingFD 0) withReadline = bracket_ stopTimer startTimer
-- Two problems are being worked around here: -- editline doesn't handle some of its system calls returning
-- 1. readline sometimes puts stdin into blocking mode,
-- so we need to put it back for the IO library
-- 2. editline doesn't handle some of its system calls returning
-- EINTR, so our timer signal confuses it, hence we turn off -- EINTR, so our timer signal confuses it, hence we turn off
-- the timer signal when making calls to editline. (#2277) -- the timer signal when making calls to editline. (#2277)
-- If editline is ever fixed, we can remove this. -- If editline is ever fixed, we can remove this.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment