Ruby and capturing ^C

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

On 4/5/07, Phy P. [email protected] 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

This should do the trick:

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

Rob