diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-05-13 13:13:13 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-05-13 13:13:13 -0400 |
commit | 23f83c876b0644b24e46f8cc1a782e2f558bf329 (patch) | |
tree | 8efdf98a48d84ce918fb562b65620d02f37b7acb /Messages.hs | |
parent | 6c6ac101616360df129770cfe7541dd7d78b2947 (diff) |
also serialize ssh password prompting when json or quiet output is enable
Diffstat (limited to 'Messages.hs')
-rw-r--r-- | Messages.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Messages.hs b/Messages.hs index f3c44aebf..83ea91dbc 100644 --- a/Messages.hs +++ b/Messages.hs @@ -54,6 +54,7 @@ import Common import Types import Types.Messages import Types.ActionItem +import Types.Concurrency import Messages.Internal import qualified Messages.JSON as JSON import qualified Annex @@ -226,10 +227,10 @@ implicitMessage = whenM (implicitMessages <$> Annex.getState Annex.output) - that the action is the only thing using the console, and can eg prompt - the user. -} -prompt :: (MessageState -> Annex a) -> Annex a -prompt a = withMessageState $ \s -> - if concurrentOutputEnabled s - then - let l = promptLock s - in bracketIO (takeMVar l) (putMVar l) (const (a s)) - else a s +prompt :: (Concurrency -> Annex a) -> Annex a +prompt a = go =<< Annex.getState Annex.concurrency + where + go NonConcurrent = a NonConcurrent + go c@(Concurrent {}) = withMessageState $ \s -> do + let l = promptLock s + bracketIO (takeMVar l) (putMVar l) (const (a c)) |