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.
|
# block, if given.
|
||||||
|
|
||||||
def Daemon.start
|
def Daemon.start
|
||||||
exit!(0) if fork
|
Process.daemon
|
||||||
Process::setsid
|
File.umask(0)
|
||||||
exit!(0) if fork
|
|
||||||
Dir::chdir("/")
|
|
||||||
File::umask(0)
|
|
||||||
STDIN.reopen(IO::NULL)
|
|
||||||
STDOUT.reopen(IO::NULL, "w")
|
|
||||||
STDERR.reopen(IO::NULL, "w")
|
|
||||||
yield if block_given?
|
yield if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user