diff options
author | Ian Lynagh <ian@well-typed.com> | 2013-06-15 21:54:22 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-06-15 21:54:22 +0100 |
commit | b097dc9a25f986f0a07dcd2ad1e7fdeeac63198a (patch) | |
tree | 8d8090cf3b88cceec60ca857f31f804d95c7bdcf /ghc | |
parent | 75947bb63794cae5950f679c8df86441b736b3fa (diff) | |
download | haskell-b097dc9a25f986f0a07dcd2ad1e7fdeeac63198a.tar.gz |
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.
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/InteractiveUI.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index c49395db33..a30410b6a8 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -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 |