logo       

Re: Catching script end?: msg#01176

lang.ruby.general

Subject: Re: Catching script end?

ts wrote:
"L" == Laurent Julliard <Laurent.Julliard@xxxxxxxxxxxxxx> writes:


L> Are you aware of anyway to catch the end of a Ruby script execution when L> there is no explicit exit instruction?

Something like this ?

pigeon% ruby -e 'at_exit { p "end" }'
"end"
pigeon%

at_exit is exactly what I was looking for. I combined this with aliasing exit! to exit (at_exit doesn't catch exit!) in my ruby module and now I catch all exit events whether they come from and explicit exit/exit! or from an implicit exit

Thanks for the tip!

Laurent





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise