Commit b097dc9a authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Fix ghci crash when the user code closes stdin

Now that we share stdin with the program, we have to check for
handle-closed as well as EOF, as the program might have closed
stdin.
parent 75947bb6
......@@ -587,6 +587,11 @@ fileLoop hdl = do
l <- liftIO $ tryIO $ hGetLine hdl
case l of
Left e | isEOFError e -> return Nothing
| -- as we share stdin with the program, the program
-- might have already closed it, so we might get a
-- handle-closed exception. We therefore catch that
-- too.
isIllegalOperation e -> return Nothing
| InvalidArgument <- etype -> return Nothing
| otherwise -> liftIO $ ioError e
where etype = ioeGetErrorType e
......
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