make a pipeReadStrict, that properly waits on the process

Nearly everything that's reading from git is operating on a small
amount of output and has been switched to use that. Only pipeNullSplit
stuff continues using the lazy version that yields zombies.
This commit is contained in:
Joey Hess 2012-10-04 18:04:09 -04:00
parent 046f51c93b
commit f67b54e5e3
6 changed files with 36 additions and 18 deletions

View file

@ -41,7 +41,7 @@ exists ref = runBool "show-ref"
sha :: Branch -> Repo -> IO (Maybe Sha)
sha branch repo = process <$> showref repo
where
showref = pipeRead [Param "show-ref",
showref = pipeReadStrict [Param "show-ref",
Param "--hash", -- get the hash
Param $ show branch]
process [] = Nothing
@ -50,7 +50,7 @@ sha branch repo = process <$> showref repo
{- List of (refs, branches) matching a given ref spec. -}
matching :: Ref -> Repo -> IO [(Ref, Branch)]
matching ref repo = map gen . lines <$>
pipeRead [Param "show-ref", Param $ show ref] repo
pipeReadStrict [Param "show-ref", Param $ show ref] repo
where
gen l = let (r, b) = separate (== ' ') l in
(Ref r, Ref b)