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

ruby-changes:15731

From: naruse <ko1@a...>
Date: Fri, 7 May 2010 17:09:46 +0900 (JST)
Subject: [ruby-changes:15731] Ruby:r27656 (trunk): Revert r26058 "* test/webrick/test_server.rb (test_daemon): simply use fork's return"

naruse	2010-05-07 17:09:37 +0900 (Fri, 07 May 2010)

  New Revision: 27656

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27656

  Log:
    Revert r26058 "* test/webrick/test_server.rb (test_daemon): simply use fork's return"
    
    This must use pipe because the target for kill is not direct child.

  Modified files:
    trunk/test/webrick/test_server.rb

Index: test/webrick/test_server.rb
===================================================================
--- test/webrick/test_server.rb	(revision 27655)
+++ test/webrick/test_server.rb	(revision 27656)
@@ -46,13 +46,19 @@
 
   def test_daemon
     begin
-      pid = Process.fork{
+      r, w = IO.pipe
+      Process.fork{
+        r.close
         WEBrick::Daemon.start
+        w.puts(Process.pid)
         sleep
       }
-      assert(Process.kill(:KILL, pid))
+      assert(Process.kill(:KILL, r.gets.to_i))
     rescue NotImplementedError
       # snip this test
+    ensure
+      r.close
+      w.close
     end
   end
 end

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

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