ruby-changes:29618
From: naruse <ko1@a...>
Date: Thu, 27 Jun 2013 19:16:28 +0900 (JST)
Subject: [ruby-changes:29618] naruse:r41670 (trunk): Get ps result if fork-wait is timeouted
naruse 2013-06-27 19:16:17 +0900 (Thu, 27 Jun 2013) New Revision: 41670 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41670 Log: Get ps result if fork-wait is timeouted Modified files: trunk/test/ruby/test_notimp.rb Index: test/ruby/test_notimp.rb =================================================================== --- test/ruby/test_notimp.rb (revision 41669) +++ test/ruby/test_notimp.rb (revision 41670) @@ -22,16 +22,17 @@ class TestNotImplement < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_notimp.rb#L22 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/