signals - Ruby prevent default CTRL+C output ^C -
i catching signal with
rescue interrupt => e
but prints:
^cshutting down!
is there way prevent default ctrl+c output:
^c
any ideas?
some terminals support stty -echoctl
disable echoing of control characters:
`stty -echoctl` begin loop # ... end rescue interrupt => e puts 'shutting down' end
if above doesn't work, can disable echoing setting io#echo=
false
:
require 'io/console' stdin.echo = false begin loop # ... end rescue interrupt => e puts 'shutting down' end
Comments
Post a Comment