From: Tim Pease Date: 2009-04-25T04:07:41+09:00 Subject: Re: proper way to daemonize On Fri, Apr 24, 2009 at 12:46 PM, Eric Hodel wrote: > On Apr 24, 2009, at 08:11, Tim Pease wrote: >> >> # ... >> >> This is the standard code to daemonize a process. The use of "exit" >> bothers me slightly, as it will call all "at_exit" handlers in the >> parent. I do not believe this is the desired behavior; the "at_exit" >> handlers will free resources that the daemonized process might need. >> Instead, "exit!" should be used to prevent "at_exit" handlers from >> being called. >> >> Any thoughts about this subtle change? Are there any undesirable side >> effects that arise from using exit! instead of exit ? > > Why not just: > > require 'webrick/server' > > WEBrick::Dameon.start > > It has exit! and all that built-in. > Eric, if I had half your brain I'd be twice as smart. Didn't even think to look through the stdlibs. Sinatra and Rails use the plain old "exit" in their flavor of the daemon method. This is causing issues with closing out log files prematurely. Just getting a consensus from the wider ruby community about the _correct_ behavior. Blessings, TwP