From: Brian Candler Date: 2008-09-18T22:03:15+09:00 Subject: Re: at_exit handler *except* for fatal runtime error synergism wrote: > How do we execute a handler (I assume via at_exit) when a program > terminates *except* when there was a fatal runtime error (e.g. any > error such as "divide by zero" that terminates the program)? "divide by zero" isn't a fatal error - you can catch it. But if you call "exit!" then the program will abort without running at_exit handlers. begin 0/0 rescue ZeroDivisionError exit! end So,if by "fatal runtime error" you just mean "any uncaught exception", then you can just wrap your entire program with begin ... rest of program rescue Exception exit! end -- Posted via http://www.ruby-forum.com/.