On 6/7/06, Dave Burt <dave / burt.id.au> wrote:
> begin
>   require "Win32API"
>   def read_char
>     Win32API.new("crtdll", "_getch", [], "L").Call
>   end
> rescue LoadError
>   def read_char
>     system "stty raw -echo"
>     STDIN.getc
>   ensure
>     system "stty -raw echo"
>   end
> end
>
> trap :INT &begin
>   require 'termios'  # http://raa.ruby-lang.org/project/ruby-termios/
>   c = Termios.tcgetattr(STDIN).cc[Termios::VINTR]
>   proc { STDIN << c }
> rescue LoadError
>   proc {}
> end
>
> Does that work?

No, but I'll play around some more.

undefined method `&' for :INT:Symbol (NoMethodError)