From 475bf70af696b82c50159aa91e643db815a3d1db Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 Mar 2014 13:54:29 -0400 Subject: [PATCH] read stdout and stderr concurrently Avoids any buffering-related blocking. --- Git/Fsck.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Git/Fsck.hs b/Git/Fsck.hs index b3948cb1da..e8fa021294 100644 --- a/Git/Fsck.hs +++ b/Git/Fsck.hs @@ -24,6 +24,7 @@ import qualified Git.Version import qualified Data.Set as S import System.Process (std_out, std_err) +import Control.Concurrent.Async type MissingObjects = S.Set Sha @@ -53,8 +54,9 @@ findBroken batchmode r = do { std_out = CreatePipe , std_err = CreatePipe } - bad1 <- readMissingObjs r supportsNoDangling (stdoutHandle p) - bad2 <- readMissingObjs r supportsNoDangling (stderrHandle p) + (bad1, bad2) <- concurrently + (readMissingObjs r supportsNoDangling (stdoutHandle p)) + (readMissingObjs r supportsNoDangling (stderrHandle p)) fsckok <- checkSuccessProcess pid let badobjs = S.union bad1 bad2