From de972c8f9be5724882906294dd1a0ebeba00ac0c Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Wed, 9 Sep 2015 15:00:58 -0700 Subject: [PATCH] Terminate processes when process thread dies #103 --- src/Turtle/Prelude.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Turtle/Prelude.hs b/src/Turtle/Prelude.hs index 94d94c6..d13a23f 100644 --- a/src/Turtle/Prelude.hs +++ b/src/Turtle/Prelude.hs @@ -360,7 +360,7 @@ system p s = liftIO (do unless finalized (hClose handle) return True ) - bracket open (\(hIn, _) -> close hIn) (\(hIn, ph) -> do + bracket open (\(hIn, ph) -> close hIn >> Process.terminateProcess ph) (\(hIn, ph) -> do let feedIn = do sh (do txt <- s @@ -394,7 +394,7 @@ systemStrict p s = liftIO (do unless finalized (hClose handle) return True ) - bracket open (\(hIn, _, _) -> close hIn) (\(hIn, hOut, ph) -> do + bracket open (\(hIn, _, ph) -> close hIn >> Process.terminateProcess ph) (\(hIn, hOut, ph) -> do let feedIn = do sh (do txt <- s @@ -461,7 +461,7 @@ stream p s = do unless finalized (hClose handle) return True ) - (hIn, hOut, ph) <- using (managed (bracket open (\(hIn, _, _) -> close hIn))) + (hIn, hOut, ph) <- using (managed (bracket open (\(hIn, _, ph) -> close hIn >> Process.terminateProcess ph))) let feedIn = do sh (do txt <- s