I believe this is by design. Exit throws an exception (SystemExit). The exception is not rescued by a default rescue clause because it doesn't derive from StandardError. Thus the raise in ensure gets called and it raises RuntimeError which gets caught in the outer rescue because RuntimeError <: StandardError.
Tomas From: Shri Borde [mailto:shri.bo...@microsoft.com] Sent: Monday, January 12, 2009 12:32 PM To: ironruby-core@rubyforge.org; ruby-c...@ruby-lang.org Subject: [ruby-core:21289] MRI 1.8.6 bug - exit is ignored if ensure clause throws exception which is caught by outer rescue The following code snippet does print "after foo" when using MRI 1.8.6 on Windows Vista, showing that exit is ignored. Any thoughts on whether this is by design, a known bug, or a new issue? If it's the latter, should I open a bug for it? def foo begin begin begin exit rescue puts "We never reach here" end ensure raise "exception from ensure" end rescue puts "We do reach here, which is unexpected" end end foo print "after foo" Thanks, Shri
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core