From: Sy Ali Date: 2006-06-08T14:51:26+09:00 Subject: Re: pausing until a character is received Well.. since I can process the characters I receive through read_char I can determine if I receive a ^c and act accordingly. Maybe this is a smarter way to act. Maybe it's going to bite me in the butt. There do appear to be some quirks with using INT, which I don't understand. I don't seem to be able to test this concept under my setup. I know my code reads like the programming equivalent to ESL, but: 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 i = 1 until i > 3 # get a character a = read_char # 3 is for ^c # TODO: This may not be portable! if a == 3 then puts "aborting..." ; break end puts "I received: " + a.to_s i = i + 1 end puts "I'm done" trap(:INT) { puts "this doesn't work" }