clear progress bar before displaying messages
authorJoey Hess <joeyh@joeyh.name>
Wed, 16 Jun 2021 00:43:00 +0000 (20:43 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 16 Jun 2021 00:51:40 +0000 (20:51 -0400)
In particular this clears it before "transfer stalled". If an external
special remote uses showInfo while progress is displayed, it will also
improve display of that.

Generally this will avoid all such problems in the future..

Sponsored-by: Svenne Krap on Patreon
Messages.hs
Messages/Internal.hs

index 563bd7e815483cc84da26fd2bf7099169c056b50..7fcee2806734d36dd8958ddbdd872f5fb6c4c72e 100644 (file)
@@ -124,14 +124,12 @@ showSideAction m = Annex.getState Annex.output >>= go
   where
        go st
                | sideActionBlock st == StartBlock = do
-                       go' st
+                       go'
                        let st' = st { sideActionBlock = InBlock }
                        Annex.changeState $ \s -> s { Annex.output = st' }
                | sideActionBlock st == InBlock = return ()
-               | otherwise = go' st
-       go' st = do
-               liftIO $ clearProgressMeter st
-               outputMessage JSON.none $ encodeBS' $ "(" ++ m ++ "...)\n"
+               | otherwise = go'
+       go' = outputMessage JSON.none $ encodeBS' $ "(" ++ m ++ "...)\n"
                        
 showStoringStateAction :: Annex ()
 showStoringStateAction = showSideAction "recording state in git"
index 138f7df2bd471529ce4dc1142e69ced7ab8355f8..30cbafc1b0e656e47e9472fc3641488af2e03887 100644 (file)
@@ -25,8 +25,12 @@ outputMessage = outputMessage' bufferJSON
 outputMessage' :: (JSONBuilder -> MessageState -> Annex Bool) -> JSONBuilder -> S.ByteString -> Annex ()
 outputMessage' jsonoutputter jsonbuilder msg = withMessageState $ \s -> case outputType s of
        NormalOutput
-               | concurrentOutputEnabled s -> concurrentMessage s False (decodeBS msg) q
-               | otherwise -> liftIO $ flushed $ S.putStr msg
+               | concurrentOutputEnabled s -> do
+                       liftIO $ clearProgressMeter s
+                       concurrentMessage s False (decodeBS msg) q
+               | otherwise -> do
+                       liftIO $ clearProgressMeter s
+                       liftIO $ flushed $ S.putStr msg
        JSONOutput _ -> void $ jsonoutputter jsonbuilder s
        QuietOutput -> q
        SerializedOutput h _ -> do