avoid using concurrent-output at all when --quiet or --json

Of course, it wasn't used much in those modes, because normal output is
avoided. But it was still initialized and used in a few places,
including a call to hideRegionsWhile.
This commit is contained in:
Joey Hess 2018-11-15 14:26:40 -04:00
parent 05bfce7ca8
commit 872af2b2f1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 12 additions and 8 deletions

View file

@ -181,11 +181,13 @@ allowConcurrentOutput a = do
c <- liftIO getNumCapabilities c <- liftIO getNumCapabilities
when (n > c) $ when (n > c) $
liftIO $ setNumCapabilities n liftIO $ setNumCapabilities n
ifM (liftIO concurrentOutputSupported) withMessageState $ \s -> case outputType s of
NormalOutput -> ifM (liftIO concurrentOutputSupported)
( Regions.displayConsoleRegions $ ( Regions.displayConsoleRegions $
goconcurrent' True goconcurrent' True
, goconcurrent' False , goconcurrent' False
) )
_ -> goconcurrent' False
goconcurrent' b = bracket_ (setup b) cleanup a goconcurrent' b = bracket_ (setup b) cleanup a
setup = setconcurrentoutputenabled setup = setconcurrentoutputenabled
cleanup = do cleanup = do

View file

@ -270,4 +270,4 @@ prompt a = go =<< Annex.getState Annex.concurrency
bracketIO bracketIO
(takeMVar l) (takeMVar l)
(putMVar l) (putMVar l)
(const $ hideRegionsWhile a) (const $ hideRegionsWhile s a)

View file

@ -123,9 +123,11 @@ concurrentOutputSupported = return True -- Windows is always unicode
- This needs a new enough version of concurrent-output; otherwise - This needs a new enough version of concurrent-output; otherwise
- the regions will not be hidden, but the action still runs, garbling the - the regions will not be hidden, but the action still runs, garbling the
- display. -} - display. -}
hideRegionsWhile :: Annex a -> Annex a hideRegionsWhile :: MessageState -> Annex a -> Annex a
#if MIN_VERSION_concurrent_output(1,9,0) #if MIN_VERSION_concurrent_output(1,9,0)
hideRegionsWhile a = bracketIO setup cleanup go hideRegionsWhile s a
| concurrentOutputEnabled s = bracketIO setup cleanup go
| otherwise = a
where where
setup = Regions.waitDisplayChange $ swapTMVar Regions.regionList [] setup = Regions.waitDisplayChange $ swapTMVar Regions.regionList []
cleanup = void . atomically . swapTMVar Regions.regionList cleanup = void . atomically . swapTMVar Regions.regionList