From: "Iñaki Baz Castillo" Date: 2008-07-21T00:01:03+09:00 Subject: Re: Does "rescue" wihtour argument handle any kind of Exception or not? El Domingo, 20 de Julio de 2008, Phlip escribió: > 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, PP::ObjectMixin, Kernel] It's different! > Also, put p $! into the rescue handler to see _what_ you rescued! ----------- require 'timeout' begin raise Interrupt rescue puts "rescued !!!" puts $! end ---------- ~# ./test.rb rescued !!! wrong number of arguments (0 for 1) ¿? -- Iñaki Baz Castillo