diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-28 00:57:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-28 00:57:53 +0000 |
commit | 69934aeb8d7948c4ca590b7092504c41d8bce6ac (patch) | |
tree | 7ea2cdc73f64c5fd001a4e626613ba435a425c0c /lib/rubygems/user_interaction.rb | |
parent | cc00f5bf36a2053e561d968a7e667ff31a9d72d7 (diff) |
rubygems 2.6.7
* lib/rubygems.rb, lib/rubygems/*, test/rubygems/*: Update
rubygems to 2.6.7.
Release note of 2.6.7: https://github.com/rubygems/rubygems/commit/60f35bd1d2359fc30301d2d4cd72bc6833e8d12a
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/user_interaction.rb')
-rw-r--r-- | lib/rubygems/user_interaction.rb | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb index 390d0f2aea..cacd782e08 100644 --- a/lib/rubygems/user_interaction.rb +++ b/lib/rubygems/user_interaction.rb @@ -7,11 +7,6 @@ require 'rubygems/util' -begin - require 'io/console' -rescue LoadError -end - ## # Module that defines the default UserInteraction. Any class including this # module will have access to the +ui+ method that returns the default UI. @@ -314,12 +309,21 @@ class Gem::StreamUI password end - if IO.method_defined?(:noecho) then - def _gets_noecho - @ins.noecho {@ins.gets} + def require_io_console + @require_io_console ||= begin + begin + require 'io/console' + rescue LoadError + end + true end - elsif Gem.win_platform? - def _gets_noecho + end + + def _gets_noecho + require_io_console + if IO.method_defined?(:noecho) then + @ins.noecho {@ins.gets} + elsif Gem.win_platform? require "Win32API" password = '' @@ -332,9 +336,7 @@ class Gem::StreamUI end end password - end - else - def _gets_noecho + else system "stty -echo" begin @ins.gets |