Iñaki Baz Castillo
7/20/2008 3:01:00 PM
El Domingo, 20 de Julio de 2008, Phlip escribi=C3=B3:
> Stefano Crocco wrote:
> >> Exception
> >> - StandardError
> >> - RuntimeError
> >> - ZeroDivisionError
> >> - ScriptError
> >> - SyntaxError
> >> - SystemExit
> >> - SignalException
> >> - Interrupt
> >>
> >> begin
> >> raise Interrupt
> >> rescue
> >> puts "rescued !!!"
> >> end
> >
> > For me, using ruby 1.8.7, patchlevel 22 on Gentoo Linux, your code works
> > as the article says, that is the exception is not being caught.
>
> Same with p22 on Ubuntu. (I think I compiled it, too.)
>
> Run p Interrupt.ancestors, and see if you get:
>
> [Interrupt, SignalException, Exception, Object, Kernel]
ruby1.8 1.8.6.36-1ubuntu3.1
irb> p Interrupt.ancestors
[Interrupt, SignalException, Exception, Object, Wirble::Shortcuts,=20
PP::ObjectMixin, Kernel]
It's different!
> Also, put p $! into the rescue handler to see _what_ you rescued!
=2D----------
require 'timeout'
begin
raise Interrupt
rescue
puts "rescued !!!"
puts $!
end
=2D---------
~# ./test.rb
rescued !!!
wrong number of arguments (0 for 1)
=C2=BF?
=2D-=20
I=C3=B1aki Baz Castillo