From: Devin Christensen Date: 2013-07-06T05:46:14+09:00 Subject: Re: How do I rescue a program exception in an at_exit block? --047d7b67244e084e3704e0c9c981 Content-Type: text/plain; charset=ISO-8859-1 If you call exit! in your at_exit block it will exit immediately and prevent other at_exit blocks from running. That might prevent the default message from being printed. You might also be able to wrap the rest of the code in a begin; rescue SystemExit; end block instead. You may find this ( http://www.bigfastblog.com/ruby-exit-exit-systemexit-and-at_exit-blunder) article helpful, especially the comment mentioned at the end. On Fri, Jul 5, 2013 at 11:33 AM, Marc Heiler wrote: > This won't help you, but I once ran into a problem with multiple at_exit > in different projects. Since I found no clean solution and they gave me > different trouble, I decided to stop using at_exit hook. Since that day > I am wondering if there is really a clear need for at_exit usage - when > I write gems, I never seem to really need it. > > -- > Posted via http://www.ruby-forum.com/. > > --047d7b67244e084e3704e0c9c981 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
If you call exit! in your at_exit block it will exit immed= iately and prevent other at_exit blocks from running. That might prevent th= e default message from being printed. You might also be able to wrap the re= st of the code in a begin; rescue SystemExit; end block instead. You may fi= nd this (http://www.bigfastblog.com/ruby-exit-exit-systemexit-and= -at_exit-blunder) article helpful, especially the comment mentioned at = the end.


On Fri, Jul 5= , 2013 at 11:33 AM, Marc Heiler <lists@ruby-forum.com> wr= ote:
This won't help you, but I once ran into= a problem with multiple at_exit
in different projects. Since I found no clean solution and they gave me
different trouble, I decided to stop using at_exit hook. Since that day
I am wondering if there is really a clear need for at_exit usage - when
I write gems, I never seem to really need it.

--
Posted via http://= www.ruby-forum.com/.


--047d7b67244e084e3704e0c9c981--