From b30f9c5660be384e0fc75a9378101439f15954a7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 16 Nov 2015 21:21:58 -0400 Subject: avoid spawning file size polling thread when not in -J mode --- Messages/Progress.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Messages') diff --git a/Messages/Progress.hs b/Messages/Progress.hs index c14e7e6b1..25d803b1b 100644 --- a/Messages/Progress.hs +++ b/Messages/Progress.hs @@ -70,7 +70,15 @@ concurrentMetered :: Maybe MeterUpdate -> Key -> (MeterUpdate -> Annex a) -> Ann concurrentMetered combinemeterupdate key a = withOutputType go where go (ConcurrentOutput _) = metered combinemeterupdate key a - go _ = a (fromMaybe (const noop) combinemeterupdate) + go _ = a (fromMaybe nullMeterUpdate combinemeterupdate) + +{- Poll file size to display meter, but only for concurrent output. -} +concurrentMeteredFile :: FilePath -> Maybe MeterUpdate -> Key -> Annex a -> Annex a +concurrentMeteredFile file combinemeterupdate key a = withOutputType go + where + go (ConcurrentOutput _) = metered combinemeterupdate key $ \p -> + watchFileSize file p a + go _ = a {- Progress dots. -} showProgressDots :: Annex () -- cgit v1.2.3