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
when (n > c) $
liftIO $ setNumCapabilities n
ifM (liftIO concurrentOutputSupported)
withMessageState $ \s -> case outputType s of
NormalOutput -> ifM (liftIO concurrentOutputSupported)
( Regions.displayConsoleRegions $
goconcurrent' True
, goconcurrent' False
)
_ -> goconcurrent' False
goconcurrent' b = bracket_ (setup b) cleanup a
setup = setconcurrentoutputenabled
cleanup = do

View file

@ -270,4 +270,4 @@ prompt a = go =<< Annex.getState Annex.concurrency
bracketIO
(takeMVar 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
- the regions will not be hidden, but the action still runs, garbling the
- display. -}
hideRegionsWhile :: Annex a -> Annex a
hideRegionsWhile :: MessageState -> Annex a -> Annex a
#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
setup = Regions.waitDisplayChange $ swapTMVar Regions.regionList []
cleanup = void . atomically . swapTMVar Regions.regionList