diff options
author | David Feuer <David.Feuer@gmail.com> | 2014-10-29 23:13:07 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2014-10-29 23:13:08 -0500 |
commit | 257cbec2f605c31d335a6709b43754a88f184d9d (patch) | |
tree | 41e3ce7f687bac9666d5f894f1689dd99ae711a3 /libraries/base | |
parent | 322810e32cb18d7749e255937437ff2ef99dca3f (diff) | |
download | haskell-257cbec2f605c31d335a6709b43754a88f184d9d.tar.gz |
Fix #9236 Error on read from closed handle
Summary:
Fixes #9236. My testing indicates that this does *not* lead to problems with
broken pipes and such, but further testing is required. It found
a bug in haddock; I've submitted a pull request upstream.
Reviewers: ekmett, austin
Reviewed By: ekmett, austin
Subscribers: rwbarton, thomie, carter, simonmar
Differential Revision: https://phabricator.haskell.org/D327
GHC Trac Issues: #9236
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/GHC/IO/Handle/Text.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs index de48bf44ae..88ec3c4e67 100644 --- a/libraries/base/GHC/IO/Handle/Text.hs +++ b/libraries/base/GHC/IO/Handle/Text.hs @@ -389,8 +389,11 @@ lazyRead handle = unsafeInterleaveIO $ withHandle "hGetContents" handle $ \ handle_ -> do case haType handle_ of - ClosedHandle -> return (handle_, "") SemiClosedHandle -> lazyReadBuffered handle handle_ + ClosedHandle + -> ioException + (IOError (Just handle) IllegalOperation "hGetContents" + "delayed read on closed handle" Nothing Nothing) _ -> ioException (IOError (Just handle) IllegalOperation "hGetContents" "illegal handle type" Nothing Nothing) |