From: James Edward Gray II Date: 2006-06-24T02:36:06+09:00 Subject: Re: Global Exception Rescue On Jun 23, 2006, at 11:07 AM, ara.t.howard@noaa.gov wrote: > harp:~ > cat env.rb > STDIN.reopen(open(__FILE__)) > at_exit do > e = $! > if e > require 'logger' > Logger.new(STDERR).fatal{ e } > end > end > > > harp:~ > cat a.rb > puts gets > raise 'foobar' > > > harp:~ > ruby -r env.rb a.rb > STDIN.reopen(open(__FILE__)) > F, [2006-06-23T10:04:35.279359 #15389] FATAL -- : foobar > (RuntimeError) > a.rb:2 > a.rb:2: foobar (RuntimeError) > > > note that the original behaviour (dumping to STDERR) is also done. > if you > don't want this add in > > at_exit do > ... > exit! > end > > regards. You are my hero! Thank you so much. James Edward Gray II