Created
October 19, 2012 03:19
-
-
Save reu/3916046 to your computer and use it in GitHub Desktop.
Password prompt for CLIs
This file contains hidden or 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
def password_prompt(message = "Inform your password: ") | |
puts message | |
begin | |
system "stty -echo -icanon" | |
gets.rstrip | |
ensure | |
system "stty echo icanon" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment