projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
af95709
)
fix a discarded exception in hClose
author
Simon Marlow
<marlowsd@gmail.com>
Wed, 1 Dec 2010 13:08:47 +0000
(13:08 +0000)
committer
Simon Marlow
<marlowsd@gmail.com>
Wed, 1 Dec 2010 13:08:47 +0000
(13:08 +0000)
GHC/IO/Handle.hs
patch
|
blob
|
history
diff --git
a/GHC/IO/Handle.hs
b/GHC/IO/Handle.hs
index
ddf17e7
..
a2273ee
100644
(file)
--- a/
GHC/IO/Handle.hs
+++ b/
GHC/IO/Handle.hs
@@
-82,14
+82,11
@@
hClose h@(FileHandle _ m) = do
mb_exc <- hClose' h m
hClose_maybethrow mb_exc h
hClose h@(DuplexHandle _ r w) = do
mb_exc <- hClose' h m
hClose_maybethrow mb_exc h
hClose h@(DuplexHandle _ r w) = do
- mb_exc1 <- hClose' h w
- mb_exc2 <- hClose' h r
- case mb_exc1 of
- Nothing -> return ()
- Just e -> hClose_maybethrow mb_exc2 h
+ excs <- mapM (hClose' h) [r,w]
+ hClose_maybethrow (listToMaybe (catMaybes excs)) h
hClose_maybethrow :: Maybe SomeException -> Handle -> IO ()
hClose_maybethrow :: Maybe SomeException -> Handle -> IO ()
-hClose_maybethrow Nothing h = return ()
+hClose_maybethrow Nothing h = return ()
hClose_maybethrow (Just e) h = hClose_rethrow e h
hClose_rethrow :: SomeException -> Handle -> IO ()
hClose_maybethrow (Just e) h = hClose_rethrow e h
hClose_rethrow :: SomeException -> Handle -> IO ()