webrick/server: simplify Daemon.start
Process.daemon exists since Ruby 1.9.1 and does most of what we need. * lib/webrick/server.rb (Daemon.start): simplify [Misc #12937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6d7dc8f7d5
commit
3dd924212f
@ -44,14 +44,8 @@ module WEBrick
|
||||
# block, if given.
|
||||
|
||||
def Daemon.start
|
||||
exit!(0) if fork
|
||||
Process::setsid
|
||||
exit!(0) if fork
|
||||
Dir::chdir("/")
|
||||
File::umask(0)
|
||||
STDIN.reopen(IO::NULL)
|
||||
STDOUT.reopen(IO::NULL, "w")
|
||||
STDERR.reopen(IO::NULL, "w")
|
||||
Process.daemon
|
||||
File.umask(0)
|
||||
yield if block_given?
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user