From 8f6a7c8a663a41f1d964cc68c6c64a3b885c67e1 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 16 May 2025 09:44:26 -1000 Subject: [PATCH] fix: web: don't hang when saving a large file [#2319] --- hledger-lib/Hledger/Utils/IO.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Utils/IO.hs b/hledger-lib/Hledger/Utils/IO.hs index 705ba55d8..2babb8bf9 100644 --- a/hledger-lib/Hledger/Utils/IO.hs +++ b/hledger-lib/Hledger/Utils/IO.hs @@ -452,8 +452,8 @@ inputToHandle t = do (r, w) <- createPipe hSetEncoding r utf8_bom hSetEncoding w utf8_bom - T.hPutStr w t - hClose w + -- use a separate thread so that we don't deadlock if we can't write all of the text at once + forkIO $ T.hPutStr w t >> hClose w return r -- | Like embedFile, but takes a path relative to the package directory.