diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-05-16 15:28:06 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-05-16 15:50:11 -0400 |
commit | 5f2ce9e7dfd19a387b79334bb3e1c496221663aa (patch) | |
tree | 92f9e9c34186884f7c8f920375b1afcded731a7e /Messages | |
parent | 68b490cd2863ef39b9c478a9da566802f3cccb1d (diff) |
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.
Diffstat (limited to 'Messages')
-rw-r--r-- | Messages/Concurrent.hs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Messages/Concurrent.hs b/Messages/Concurrent.hs index 41153d067..78eed3bb1 100644 --- a/Messages/Concurrent.hs +++ b/Messages/Concurrent.hs @@ -1,6 +1,6 @@ {- git-annex output messages, including concurrent output to display regions - - - Copyright 2010-2016 Joey Hess <id@joeyh.name> + - Copyright 2010-2017 Joey Hess <id@joeyh.name> - - Licensed under the GNU GPL version 3 or higher. -} @@ -10,8 +10,9 @@ module Messages.Concurrent where -import Annex +import Types import Types.Messages +import qualified Annex #ifdef WITH_CONCURRENTOUTPUT import Common @@ -136,3 +137,22 @@ concurrentOutputSupported = return True -- Windows is always unicode #else concurrentOutputSupported = return False #endif + +{- Hide any currently displayed console regions while running the action, + - so that the action can use the console itself. + - 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 +#if MIN_VERSION_concurrent_output(1,9,0) +hideRegionsWhile a = bracketIO setup cleanup go + where + setup = Regions.waitDisplayChange $ swapTMVar Regions.regionList [] + cleanup = void . atomically . swapTMVar Regions.regionList + go _ = do + liftIO $ hFlush stdout + a +#else +#warning Building with concurrent-output older than 1.9.0 so expect some display glitches when password prompts occur in concurrent mode +hideRegionsWhile = id +#endif |