on master help sign in
Mark a Handle as closed when we're done with it
5d980d0Bryan O'Sullivan
Data/Text/IO.hs+2−2
@@ -55,7 +55,7 @@ import GHC.IO.Handle.Internals (augmentIOError, hClose_help, wantReadableHandle,
55 wantWritableHandle)
55 wantWritableHandle)
56import GHC.IO.Handle.Text (commitBuffer')
56import GHC.IO.Handle.Text (commitBuffer')
57import GHC.IO.Handle.Types (BufferList(..), BufferMode(..), Handle__(..),
57import GHC.IO.Handle.Types (BufferList(..), BufferMode(..), Handle__(..),
58− Newline(..))
58+ HandleType(..), Newline(..))
59import System.IO (hGetBuffering, hFileSize, hSetBuffering, hTell)
59import System.IO (hGetBuffering, hFileSize, hSetBuffering, hTell)
60import System.IO.Error (isEOFError)
60import System.IO.Error (isEOFError)
61#endif
61#endif
@@ -94,7 +94,7 @@ hGetContents h = do
94 chooseGoodBuffering h
94 chooseGoodBuffering h
95 wantReadableHandle "hGetContents" h $ \hh -> do
95 wantReadableHandle "hGetContents" h $ \hh -> do
96 (hh',ts) <- readAll hh
96 (hh',ts) <- readAll hh
97− return (hh',T.concat ts)
97+ return (hh'{haType=ClosedHandle},T.concat ts)
98 where
98 where
99 readAll hh@Handle__{..} = do
99 readAll hh@Handle__{..} = do
100 buf <- readIORef haCharBuffer
100 buf <- readIORef haCharBuffer