Skip to content

Instantly share code, notes, and snippets.

@sorah
Created November 6, 2018 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorah/9e794840614c6188bc41dc3a36baa795 to your computer and use it in GitHub Desktop.
Save sorah/9e794840614c6188bc41dc3a36baa795 to your computer and use it in GitHub Desktop.
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