From 044387a1d7cb6e8481921172843f6ce1e4bb457c Mon Sep 17 00:00:00 2001 From: naruse Date: Thu, 27 Jun 2013 10:16:17 +0000 Subject: Get ps result if fork-wait is timeouted git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_notimp.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'test/ruby/test_notimp.rb') diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb index 04f1d8550d..6733d0ce0e 100644 --- a/test/ruby/test_notimp.rb +++ b/test/ruby/test_notimp.rb @@ -22,16 +22,17 @@ class TestNotImplement < Test::Unit::TestCase def test_call_fork pid = nil - GC.start - Timeout.timeout(1) { - pid = fork {} - Process.wait pid - pid = nil - } - ensure - if pid - Process.kill :KILL, pid + begin + Timeout.timeout(1) { + pid = fork {} + Process.wait pid + pid = nil + } + rescue Timeout::Error + ps = `ps -l #{pid}` + Process.kill(:KILL, pid) Process.wait pid + assert_equal nil, pid, ps end end if Process.respond_to?(:fork) -- cgit v1.2.3