Skip to content

Fix hGetContents to close handle on exception - #718

Open
Lysxia wants to merge 1 commit into
masterfrom
exception-getContents
Open

Lysxia wants to merge 1 commit into
masterfrom
exception-getContents

Conversation

@Lysxia

@Lysxia Lysxia commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Close #712

@Lysxia
Lysxia force-pushed the exception-getContents branch from 104176c to f346371 Compare October 25, 2026 21:07
@Lysxia
Lysxia force-pushed the exception-getContents branch from f346371 to bdec0dd Compare October 25, 2026 21:15
hClose h0

-- readFile must close the handle on exception
let checkReadFile rf = do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a type signature for checkReadFile?

Comment thread src/Data/Text/IO.hs
Left e | Just ioe <- E.fromException e -> E.throwIO (augmentIOError ioe "hGetContents" h)
Left e -> E.throwIO
#if __GLASGOW_HASKELL__ >= 912
(E.NoBacktrace e)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want no backtrace? (I'm rather illiterate when it comes to exceptions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hGetContents does not close handle on exception

2 participants