@@ -14,7 +14,7 @@ module Stack.Upload
1414 ) where
1515
1616import Control.Applicative
17- import Control.Exception.Safe (bracket , handleIO , tryIO )
17+ import Control.Exception.Safe (handleIO , tryIO )
1818import qualified Control.Exception as E
1919import Control.Monad (void , when , unless )
2020import Data.Aeson (FromJSON (.. ),
@@ -54,8 +54,8 @@ import Stack.Types.StringError
5454import System.Directory (createDirectoryIfMissing ,
5555 removeFile )
5656import System.FilePath ((</>) , takeFileName )
57- import System.IO (hFlush , hGetEcho , hSetEcho ,
58- stdin , stdout )
57+ import System.IO (hFlush , stdout )
58+ import System.IO.Echo ( withoutInputEcho )
5959
6060-- | Username and password to log into Hackage.
6161--
@@ -121,10 +121,8 @@ promptPassword :: IO Text
121121promptPassword = do
122122 putStr " Hackage password: "
123123 hFlush stdout
124- -- save/restore the terminal echoing status
125- passwd <- bracket (hGetEcho stdin) (hSetEcho stdin) $ \ _ -> do
126- hSetEcho stdin False -- no echoing for entering the password
127- fmap T. pack getLine
124+ -- save/restore the terminal echoing status (no echoing for entering the password)
125+ passwd <- withoutInputEcho $ fmap T. pack getLine
128126 putStrLn " "
129127 return passwd
130128
0 commit comments