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

···

____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

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

···

On 4/5/07, Phy Prabab <phyprabab@yahoo.com> wrote:

____________________________________________________________________________________
The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

This should do the trick:

trap("INT") do
    ...code block...
end

Rob

···

On 4/4/07, Logan Capaldo <logancapaldo@gmail.com> wrote:

On 4/5/07, Phy Prabab <phyprabab@yahoo.com> 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?
ruby trap - Google Search
>
____________________________________________________________________________________
> The fish are biting.
> Get more visitors on your site using Yahoo! Search Marketing.
> http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

--
c++: the power, elegance and simplicity of a hand grenade
http://www.migrob.com