-
-
Save epitron/2e63eeec4ddcca2103fd to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
require 'io/console' | |
thread = Thread.new do | |
$stdin.each_line do |line| | |
print "stdin: #{line}\r" | |
end | |
end | |
IO.console.raw do |io| | |
loop do | |
char = io.getc | |
puts "tty: #{char}\r" | |
break if char == "q" | |
end | |
end | |
puts "Done!\r" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To test it: