From c07525ac4692a2ee9c76bd0bd53c195c8164480f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Tue, 5 Aug 2025 22:04:11 +0200 Subject: Close handles created for spawned processes --- src/Process.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Process.hs') diff --git a/src/Process.hs b/src/Process.hs index 31641c9..8ea345d 100644 --- a/src/Process.hs +++ b/src/Process.hs @@ -85,9 +85,10 @@ outProc otype p line = outLine otype (Just $ textProcName $ procName p) line lineReadingLoop :: MonadOutput m => Process -> Handle -> (Text -> m ()) -> m () lineReadingLoop process h act = liftIO (tryIOError (T.hGetLine h)) >>= \case - Left err - | isEOFError err -> return () - | otherwise -> outProc OutputChildFail process $ T.pack $ "IO error: " ++ show err + Left err -> do + when (not (isEOFError err)) $ do + outProc OutputChildFail process $ T.pack $ "IO error: " ++ show err + liftIO $ hClose h Right line -> do act line lineReadingLoop process h act -- cgit v1.2.3