Created
November 7, 2012 17:14
-
-
Save jstotz/4033022 to your computer and use it in GitHub Desktop.
Terminal prompt after reading $stdin
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
puts "Reading lines..." | |
$stdin.each_line do |line| | |
puts "IN: #{line}" | |
end | |
$stdin.reopen File.open("/dev/tty", "r") | |
puts "Awaiting user input..." | |
puts "USER INPUT: #{$stdin.gets}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment