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

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -