Skip to content

Commit

Permalink
Depend on echo to fix #4128
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Dec 22, 2016
1 parent 09865f6 commit 0469aba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cabal-install/Distribution/Client/Upload.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import qualified Distribution.Client.BuildReports.Upload as BuildReport
import Network.URI (URI(uriPath))
import Network.HTTP (Header(..), HeaderName(..))

import System.IO (hFlush, stdin, stdout, hGetEcho, hSetEcho)
import System.IO (hFlush, stdout)
import System.IO.Echo (withoutInputEcho)
import System.Exit (exitFailure)
import Control.Exception (bracket)
import System.FilePath ((</>), takeExtension, takeFileName, dropExtension)
import qualified System.FilePath.Posix as FilePath.Posix ((</>))
import System.Directory
Expand Down Expand Up @@ -140,10 +140,8 @@ promptPassword :: IO Password
promptPassword = do
putStr "Hackage password: "
hFlush stdout
-- save/restore the terminal echoing status
passwd <- bracket (hGetEcho stdin) (hSetEcho stdin) $ \_ -> do
hSetEcho stdin False -- no echoing for entering the password
fmap Password getLine
-- save/restore the terminal echoing status (no echoing for entering the password)
passwd <- withoutInputEcho $ fmap Password getLine
putStrLn ""
return passwd

Expand Down
4 changes: 4 additions & 0 deletions cabal-install/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ BASE64_BYTESTRING_VER="1.0.0.1"; BASE64_BYTESTRING_VER_REGEXP="1\."
# >=1.0
CRYPTOHASH_SHA256_VER="0.11.100.1"; CRYPTOHASH_SHA256_VER_REGEXP="0\.11\.?"
# 0.11.*
ECHO_VER="0.1"; ECHO_VER_REGEXP="0\.1\.?"
# 0.1.*
EDIT_DISTANCE_VER="0.2.2.1"; EDIT_DISTANCE_VER_REGEXP="0\.2\.2\.?"
# 0.2.2.*
ED25519_VER="0.0.5.0"; ED25519_VER_REGEXP="0\.0\.?"
Expand Down Expand Up @@ -485,6 +487,7 @@ info_pkg "base64-bytestring" ${BASE64_BYTESTRING_VER} \
${BASE64_BYTESTRING_VER_REGEXP}
info_pkg "cryptohash-sha256" ${CRYPTOHASH_SHA256_VER} \
${CRYPTOHASH_SHA256_VER_REGEXP}
info_pkg "echo" ${ECHO_VER} ${ECHO_VER_REGEXP}
info_pkg "edit-distance" ${EDIT_DISTANCE_VER} ${EDIT_DISTANCE_VER_REGEXP}
info_pkg "ed25519" ${ED25519_VER} ${ED25519_VER_REGEXP}
info_pkg "tar" ${TAR_VER} ${TAR_VER_REGEXP}
Expand Down Expand Up @@ -521,6 +524,7 @@ do_pkg "base64-bytestring" ${BASE64_BYTESTRING_VER} \
${BASE64_BYTESTRING_VER_REGEXP}
do_pkg "cryptohash-sha256" ${CRYPTOHASH_SHA256_VER} \
${CRYPTOHASH_SHA256_VER_REGEXP}
do_pkg "echo" ${ECHO_VER} ${ECHO_VER_REGEXP}
do_pkg "edit-distance" ${EDIT_DISTANCE_VER} ${EDIT_DISTANCE_VER_REGEXP}
do_pkg "ed25519" ${ED25519_VER} ${ED25519_VER_REGEXP}

Expand Down
1 change: 1 addition & 0 deletions cabal-install/cabal-install.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ executable cabal
containers >= 0.4 && < 0.6,
cryptohash-sha256 >= 0.11 && < 0.12,
deepseq >= 1.3 && < 1.5,
echo >= 0.1 && < 0.2,
edit-distance >= 0.2.2 && < 0.3,
filepath >= 1.3 && < 1.5,
hashable >= 1.0 && < 2,
Expand Down

0 comments on commit 0469aba

Please sign in to comment.