From 77c2d3b36ace1bb159598404d3173d7714e6629f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 18 Mar 2013 22:09:51 -0400 Subject: assistant: The ConfigMonitor left one zombie behind each time it checked for changes, now fixed. --- Git/Command.hs | 6 ++++++ Git/LsTree.hs | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'Git') diff --git a/Git/Command.hs b/Git/Command.hs index f3841c7fa..e6cec16fb 100644 --- a/Git/Command.hs +++ b/Git/Command.hs @@ -94,6 +94,12 @@ pipeNullSplit params repo = do where sep = "\0" +pipeNullSplitStrict :: [CommandParam] -> Repo -> IO [String] +pipeNullSplitStrict params repo = do + s <- pipeReadStrict params repo + return $ filter (not . null) $ split sep s + where + sep = "\0" pipeNullSplitZombie :: [CommandParam] -> Repo -> IO [String] pipeNullSplitZombie params repo = leaveZombie <$> pipeNullSplit params repo diff --git a/Git/LsTree.hs b/Git/LsTree.hs index c61ae7fab..6e4cd8470 100644 --- a/Git/LsTree.hs +++ b/Git/LsTree.hs @@ -29,15 +29,17 @@ data TreeItem = TreeItem , file :: FilePath } deriving Show -{- Lists the complete contents of a tree. -} +{- Lists the complete contents of a tree, with lazy output. -} lsTree :: Ref -> Repo -> IO [TreeItem] -lsTree t repo = map parseLsTree <$> - pipeNullSplitZombie [Params "ls-tree --full-tree -z -r --", File $ show t] repo +lsTree t repo = map parseLsTree <$> pipeNullSplitZombie ps repo + where + ps = [Params "ls-tree --full-tree -z -r --", File $ show t] {- Lists specified files in a tree. -} lsTreeFiles :: Ref -> [FilePath] -> Repo -> IO [TreeItem] -lsTreeFiles t fs repo = map parseLsTree <$> - pipeNullSplitZombie ([Params "ls-tree -z --", File $ show t] ++ map File fs) repo +lsTreeFiles t fs repo = map parseLsTree <$> pipeNullSplitStrict ps repo + where + ps = [Params "ls-tree -z --", File $ show t] ++ map File fs {- Parses a line of ls-tree output. - (The --long format is not currently supported.) -} -- cgit v1.2.3