From 5f2ce9e7dfd19a387b79334bb3e1c496221663aa Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 May 2017 15:28:06 -0400 Subject: clear regions before ssh prompt When built with concurrent-output 1.9, ssh password prompts will no longer interfere with the -J display. To avoid flicker, only done when ssh actually does need to prompt; ssh is first run in batch mode and if that succeeds the connection is up and no need to clear regions. This commit was supported by the NSF-funded DataLad project. --- Messages.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Messages.hs') diff --git a/Messages.hs b/Messages.hs index 83ea91dbc..ff13b31ee 100644 --- a/Messages.hs +++ b/Messages.hs @@ -56,6 +56,7 @@ import Types.Messages import Types.ActionItem import Types.Concurrency import Messages.Internal +import Messages.Concurrent import qualified Messages.JSON as JSON import qualified Annex @@ -227,10 +228,13 @@ implicitMessage = whenM (implicitMessages <$> Annex.getState Annex.output) - that the action is the only thing using the console, and can eg prompt - the user. -} -prompt :: (Concurrency -> Annex a) -> Annex a +prompt :: Annex a -> Annex a prompt a = go =<< Annex.getState Annex.concurrency where - go NonConcurrent = a NonConcurrent - go c@(Concurrent {}) = withMessageState $ \s -> do + go NonConcurrent = a + go (Concurrent {}) = withMessageState $ \s -> do let l = promptLock s - bracketIO (takeMVar l) (putMVar l) (const (a c)) + bracketIO + (takeMVar l) + (putMVar l) + (const $ hideRegionsWhile a) -- cgit v1.2.3