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.
This commit is contained in:
Joey Hess 2017-05-16 15:28:06 -04:00
parent 89f9be3230
commit 1d45e47e3f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 52 additions and 14 deletions

View file

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