From: WayneFChin@... (Wayne F. Chin) Date: 2002-08-10T09:05:21+09:00 Subject: Re: Catching script end? Laurent Julliard wrote in message news:<3D53EC0C.5060405@xrce.xerox.com>... > All, > > Are you aware of anyway to catch the end of a Ruby script execution when > there is no explicit exit instruction? > > a) SystemExit seems to be raised only when 'exit' is used explicitely. > b) I have found a workaround to catch exit! as well by redefining > > But what to do when there is no exit at all ? > > Thanks for your help > > Laurent How about using an END block? In this example, I use an END block and its complementarhy BEGIN block: BEGIN { puts 'Welcome' } puts 'hello, world' END { puts 'Goodbye, cruel world.' } gives: Welcome hello, world Goodbye, cruel world.