Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Created June 16, 2009 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baroquebobcat/130737 to your computer and use it in GitHub Desktop.
Save baroquebobcat/130737 to your computer and use it in GitHub Desktop.
#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