Hi,

At Tue, 5 Jul 2005 18:01:28 +0900,
Brian Candler wrote in [ruby-talk:147202]:
> If you want app to run as a daemon and never worry about when it terminates
> (even if the Ruby program terminates first), then you can fork twice, run

If the parent program terminates before the child, you don't
have to worry if the child becomes a zombie.  Instead, It will
be adopted by the init process.

> 'atexit' script you've previously defined will run in both parent and child.

No, system nor exec don't invoke at_exit handlers.

  $ ruby -e 'at_exit{puts "#$$ exiting"}; system("echo foo")'
  foo
  1020 exiting

  $ ruby -e 'at_exit{puts "#$$ exiting"}; Process.waitpid(fork {exec("echo foo")})'
  foo
  1772 exiting

  $ ruby -e 'at_exit{puts "#$$ exiting"}; Process.waitpid(fork {puts "foo"})'
  foo
  2228 exiting
  2108 exiting

-- 
Nobu Nakada