Ruby and capturing ^C


#1

Hello!

Is there any way to capture or “trap” ^C within Ruby? Something similar
to shell “trapping” is what I am after so that I can do clean up in the
event ^C is pressed.

TIA!
Phy


#2

On 4/5/07, Phy P. removed_email_address@domain.invalid wrote:

Hello!

Is there any way to capture or “trap” ^C within Ruby? Something similar to shell “trapping” is what I am after so that I can do clean up in the event ^C is pressed.

TIA!
Phy

It’s one thing when you don’t know what to search for, but did you even
try?
http://www.google.com/search?hl=en&q=ruby+trap&btnG=Google+Search


#3

This should do the trick:

trap(“INT”) do
…code block…
end

Rob