core: UI#ask with no echo works even if noecho not supported [GH-3119]

This commit is contained in:
Mitchell Hashimoto 2014-03-11 09:58:19 -07:00
parent 32adbf9e58
commit eb9b85c388
3 changed files with 18 additions and 4 deletions

View File

@ -7,6 +7,8 @@ BUG FIXES:
- core: Upgrading the home directory for Vagrant 1.5 uses the Vagrant
temp dir. [GH-3095]
- core: Assume a box isn't metadata if it exceeds 20 MB. [GH-3107]
- core: Asking for input works even in consoles that don't support
hiding input. [GH-3119]
- provisioners/ansible: Request SSH info within the provision method,
when we know its available. [GH-3111]

View File

@ -147,11 +147,19 @@ module Vagrant
if opts[:echo]
input = $stdin.gets
else
input = $stdin.noecho(&:gets)
begin
input = $stdin.noecho(&:gets)
# Output a newline because without echo, the newline isn't
# echoed either.
say(:info, "\n", opts)
# Output a newline because without echo, the newline isn't
# echoed either.
say(:info, "\n", opts)
rescue Errno::EBADF
# This means that stdin doesn't support echoless input.
say(:info, "\n#{I18n.t("vagrant.stdin_cant_hide_input")}\n ", opts)
# Ask again, with echo enabled
input = ask(message, opts.merge(echo: true))
end
end
# Get the results and chomp off the newline. We do a logical OR

View File

@ -166,6 +166,10 @@ en:
password-based authentication. Vagrant can't script entering the
password for you. If you're prompted for a password, please enter
the same password you have configured in the Vagrantfile.
stdin_cant_hide_input: |-
Error! Your console doesn't support hiding input. We'll ask for
input again below, but we WILL NOT be able to hide input. If this
is a problem for you, ctrl-C to exit and fix your stdin.
cfengine_config:
classes_array: |-