handle git-credential prompt in -J mode
If git-credential has it cached and does not prompt, this will unfortunately result in a brief flicker, as the displayed console regions are hidden while running it and then re-displayed. Better than a corrupted display. Actually, I tried it and don't see a visible flicker, so probably only over a slow ssh will it be apparent.
This commit is contained in:
parent
1883f7ef8f
commit
6f90bb7738
4 changed files with 30 additions and 16 deletions
|
@ -18,6 +18,7 @@ import Common
|
|||
import qualified System.Console.Concurrent as Console
|
||||
import qualified System.Console.Regions as Regions
|
||||
import Control.Concurrent.STM
|
||||
import Control.Monad.IO.Class
|
||||
import qualified Data.Text as T
|
||||
#ifndef mingw32_HOST_OS
|
||||
import GHC.IO.Encoding
|
||||
|
@ -120,13 +121,14 @@ concurrentOutputSupported = return True -- Windows is always unicode
|
|||
|
||||
{- Hide any currently displayed console regions while running the action,
|
||||
- so that the action can use the console itself. -}
|
||||
hideRegionsWhile :: MessageState -> Annex a -> Annex a
|
||||
hideRegionsWhile s a
|
||||
| concurrentOutputEnabled s = bracketIO setup cleanup go
|
||||
hideRegionsWhile :: (MonadIO m, Monad m, MonadMask m) => MessageState -> m a -> m a
|
||||
hideRegionsWhile s a
|
||||
| concurrentOutputEnabled s = bracket setup cleanup go
|
||||
| otherwise = a
|
||||
where
|
||||
setup = Regions.waitDisplayChange $ swapTMVar Regions.regionList []
|
||||
cleanup = void . atomically . swapTMVar Regions.regionList
|
||||
setup = liftIO $
|
||||
Regions.waitDisplayChange $ swapTMVar Regions.regionList []
|
||||
cleanup = liftIO . void . atomically . swapTMVar Regions.regionList
|
||||
go _ = do
|
||||
liftIO $ hFlush stdout
|
||||
a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue