From: Eric Armstrong Date: 2006-04-14T13:50:55+09:00 Subject: Re: Rake: Making "cleanup" task Thanks. It must be standard on unix systems. All those years wasted mastering Data General technologies... Sigh. :_) Guillaume Marcais wrote: > Note that this is fairly "standard" and exists also in C. From the man > page of exit() on Linux: > > DESCRIPTION > The exit() function causes normal program termination and the > the value of > status & 0377 is returned to the parent (see wait(2)). All > functions regis- > tered with atexit() and on_exit() are called in the reverse > order of their > registration, and all open streams are flushed and closed. Files > created by > tmpfile() are removed. > > Guillaume. > > Le 10 avr. 06, � 19:47, Eric Armstrong a �crit : > >> Most excellent. How on earth did you find that? >> How did you know to look for it, orginally? >> >> Or did you just happen to stumble across it while >> persuing API docs using ri?? (In which case, that >> would seem to be the thing to do!) >> >> Logan Capaldo wrote: >>> On Apr 7, 2006, at 9:10 PM, Eric Armstrong wrote: >>>> That's looking like a cool solution. What is that >>>> at_exit thing, btw? Is that a standard part of rake >>>> I should know about? >>> at_exit is a standard part of ruby >>> % ri at_exit >>> --------------------------------------------------------- Kernel#at_exit >>> at_exit { block } -> proc >>> ------------------------------------------------------------------------ >>> Converts block to a Proc object (and therefore binds it at the >>> point of call) and registers it for execution when the program >>> exits. If multiple handlers are registered, they are executed in >>> reverse order of registration. >>> def do_at_exit(str1) >>> at_exit { print str1 } >>> end >>> at_exit { puts "cruel world" } >>> do_at_exit("goodbye ") >>> exit >>> produces: >>> goodbye cruel world >> >> > > >