Created
January 9, 2013 03:55
-
-
Save yaeda/4490414 to your computer and use it in GitHub Desktop.
Rubyでecho無しに標準入力させる方法
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
# < 1.9.3 | |
print "type PASSWORD : " | |
system "stty -echo" | |
password = gets.chop | |
system "stty echo" | |
# > 1.9.3 | |
require 'io/console' | |
print "type PASSWORD : " | |
password = STDIN.noecho(&:gets).chop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chopは改行コードの削除