From: Kaspar Schiess Date: 2004-11-26T18:27:35+09:00 Subject: Re: [Q] Catching exceptions at top level Laurent Julliard wrote in news:41A654AB.1070002 @moldus.org: > The problem is that I must leave the original file containing the code > unchanged so it has to be a mechanism that i can include with a piece > of code added at runtime with a -r option The solution was there, but I will make that explicit: catcher.rb --------------------------------------- END { puts 'exception has happened.' p $! } ----------------------------------------------------- test.rb --------------------------------------------- raise 'dodah' ----------------------------------------------------- Call as ruby -rcatcher test.rb gives you exception has happened. # test.rb:1: dodah (RuntimeError) yours, kaspar hand manufactured code - www.tua.ch/ruby