Skip to content

Instantly share code, notes, and snippets.

@epitron
Created December 12, 2014 08:16
Show Gist options
  • Save epitron/2e63eeec4ddcca2103fd to your computer and use it in GitHub Desktop.
Save epitron/2e63eeec4ddcca2103fd to your computer and use it in GitHub Desktop.
#!/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
@epitron
Copy link
Author

epitron commented Dec 12, 2014

To test it:

while true; do echo yep; sleep 1; done | page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment