summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-07 08:09:37 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-07 08:09:37 +0000
commit44ff836e58dcfba6019ade3a4d661114434f3877 (patch)
tree7838b5b938427a7fc089db046010a6ef143b963d
parent5cea3d2b175781402814e94134dbc8bf5dfcbd9d (diff)
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/webrick/test_server.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/webrick/test_server.rb b/test/webrick/test_server.rb
index b688d52018..99c59d5056 100644
--- a/test/webrick/test_server.rb
+++ b/test/webrick/test_server.rb
@@ -46,13 +46,19 @@ class TestWEBrickServer < Test::Unit::TestCase
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