avoid spawning file size polling thread when not in -J mode

This commit is contained in:
Joey Hess 2015-11-16 21:21:58 -04:00
parent e97fce35a6
commit 3449c0e8ec
Failed to extract signature
2 changed files with 11 additions and 5 deletions

View file

@ -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 ()