Class: WEBrick::Daemon

Inherits:
Object
  • Object
show all
Defined in:
lib/webrick/server.rb

Class Method Summary collapse

Class Method Details

.startObject



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/webrick/server.rb', line 28

def Daemon.start
  exit!(0) if fork
  Process::setsid
  exit!(0) if fork
  Dir::chdir("/")
  File::umask(0)
  STDIN.reopen("/dev/null")
  STDOUT.reopen("/dev/null", "w")
  STDERR.reopen("/dev/null", "w")
  yield if block_given?
end