[前][次][番号順一覧][スレッド一覧]

ruby-changes:44796

From: normal <ko1@a...>
Date: Tue, 22 Nov 2016 09:16:32 +0900 (JST)
Subject: [ruby-changes:44796] normal:r56869 (trunk): webrick/server: simplify Daemon.start

normal	2016-11-22 09:16:23 +0900 (Tue, 22 Nov 2016)

  New Revision: 56869

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56869

  Log:
    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]

  Modified files:
    trunk/lib/webrick/server.rb
Index: lib/webrick/server.rb
===================================================================
--- lib/webrick/server.rb	(revision 56868)
+++ lib/webrick/server.rb	(revision 56869)
@@ -44,14 +44,8 @@ module WEBrick https://github.com/ruby/ruby/blob/trunk/lib/webrick/server.rb#L44
     # 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]