From: Josh Cheek Date: 2011-02-01T12:01:26+09:00 Subject: Re: How to know the exit status within at_exit() block? --0016364ee65c6f7c8c049b2fbf93 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Jan 31, 2011 at 5:09 PM, I=F1aki Baz Castillo wrote= : > Hi, my program invokes "exit true" or "exit false" and I want to catch > such return code into at_exit() block, but I don't know how to do > that. > > I would like something as: > > > at_exit(exit_status) { > puts "exiting with status #{status}" > } > > if SOMETHING > exit true > else > exit false > end > > > Of course I call "exit" from lof of clases/modules under my project so > I cannot use a local scope variable "status" (and I wouldn't like to > use a global variable). > > Thanks for any suggestion. > > -- > I=F1aki Baz Castillo > > > How about stick your own exit method before Kernel in the lookup chain class Object private def exit(status=3Dtrue) at_exit { puts "exiting with status #{status}" } super end end --0016364ee65c6f7c8c049b2fbf93--