From a55567a066b1cf8851da606a1dafbe38f4cec520 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 30 Jul 2010 05:50:54 +0000 Subject: * lib/net/imap.rb: load io/console. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/net/imap.rb | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/net/imap.rb b/lib/net/imap.rb index a032a1850d..9de6395236 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -2001,9 +2001,9 @@ module Net BEG_REGEXP = /\G(?:\ (?# 1: SPACE )( +)|\ -(?# 2: NIL )(NIL)(?=[\x80-\xff(){ \x00-\x1f\x7f%*"\\\[\]+])|\ -(?# 3: NUMBER )(\d+)(?=[\x80-\xff(){ \x00-\x1f\x7f%*"\\\[\]+])|\ -(?# 4: ATOM )([^\x80-\xff(){ \x00-\x1f\x7f%*"\\\[\]+]+)|\ +(?# 2: NIL )(NIL)(?=[\x80-\xff(){ \x00-\x1f\x7f%*#{'"'}\\\[\]+])|\ +(?# 3: NUMBER )(\d+)(?=[\x80-\xff(){ \x00-\x1f\x7f%*#{'"'}\\\[\]+])|\ +(?# 4: ATOM )([^\x80-\xff(){ \x00-\x1f\x7f%*#{'"'}\\\[\]+]+)|\ (?# 5: QUOTED )"((?:[^\x00\r\n"\\]|\\["\\])*)"|\ (?# 6: LPAR )(\()|\ (?# 7: RPAR )(\))|\ @@ -3486,6 +3486,23 @@ usage: #{$0} [options] EOF end + begin + require 'io/console' + rescue LoadError + def _noecho(&block) + system("stty", "-echo") + begin + yield STDIN + ensure + system("stty", "echo") + end + end + else + def _noecho(&block) + STDIN.noecho(&block) + end + end + def get_password print "password: " begin -- cgit v1.2.3