On Dec 9, 2005, at 8:50 AM, Jim Freeze wrote:

> On 12/8/05, Joe Van Dyk <joevandyk / gmail.com> wrote:
>> trap("INT") do
>>   puts "got signal INT"
>> end
>>
>> puts "Sup"
>> gets
>>
>> hump:[]:/home/mz652c% ruby signal.rb
>> Sup
>> got signal INT
>> got signal INT
>
> Interesting. When I ran the program above I get:
> ^Cgot signal INT
> ....
>
> Any ideas on how to not get the '^C' text?

The ^C is your ctrl-c being echoed by the
terminal device driver.  You can use the stty
program to alter the behavior of the tty driver.
In  particular, take a look at the -echoctl
option.  In any case, the foreground process (ruby) doesn't
see the ctrl-c because the tty driver discards
it and sends the Interrupt signal instead and then takes
car of echoing '^C' back to the terminal itself.

The specific behavior may also depend on the particular
shell you are using.

Hope this helps.