Created
June 16, 2009 15:19
-
-
Save baroquebobcat/130737 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#way to stop echoing to console while getting a password | |
#and to do it w/o pulling in another library | |
#ref: http://www.ruby-forum.com/topic/107442#243864 | |
# http://stackoverflow.com/questions/133719/how-to-read-a-password-in-ruby | |
def gets_pass | |
begin | |
system "stty -echo" | |
password = gets.chomp | |
ensure | |
system "stty echo" | |
end | |
password | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment