Is it possible, in Ruby, to raise an Exception that will also automatically abort the program, ignoring any enclosing begin/rescue blocks?
Unfortunately, none of these exit
answers will work. exit
raises SystemExit
which can be caught. Observe:
begin
exit
rescue SystemExit
end
puts "Still here!"
As @dominikh says, you need to use exit!
instead:
begin
exit!
rescue SystemExit
end
puts "Didn't make it here :("