-
-
Save sorah/9e794840614c6188bc41dc3a36baa795 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
require 'io/console' | |
$stdin.raw do | |
$stdin.noecho do | |
loop do | |
print "\r" | |
begin | |
c = $stdin.read_nonblock(1) | |
p c | |
exit if c == ?; | |
rescue => e | |
p e | |
a, *_ = IO.select([$stdin], [], [], 1) | |
p a | |
end | |
sleep 0.1 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment