WEBRick initialization

I have some WEBRick server that I would like to run as WEBRick::Daemon (that's where a startup process forks a daemon and exits). The problem is, there is some initialization code that must be executed _after_ the fork (it opens a file for writing). Is there any good way to make it happen (short of overriding WEBRick::Daemon#start method)?

Best regards,
Alexey Verkhovsky

In message <429FB360.3060505@verk.info>,

I have some WEBRick server that I would like to run as WEBRick::Daemon
(that's where a startup process forks a daemon and exits). The problem
is, there is some initialization code that must be executed _after_ the
fork (it opens a file for writing). Is there any good way to make it
happen (short of overriding WEBRick::Daemon#start method)?

How about calling WEBrick::Daemon.start directly?

  require "webrick"

  WEBrick::Daemon.start
  httpd = WEBrick::HTTPServer.new(:Port=>10080)
  trap(:INT){ httpd.stop }
  httpd.mount_proc("/"){|req, res|
    res["content-type"] = "text/plain"
    res.body = $$.to_s
  }
  httpd.start

···

`Alexey Verkhovsky <alex@verk.info>' wrote:

--
gotoyuzo