diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-27 10:16:17 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-27 10:16:17 +0000 |
commit | 044387a1d7cb6e8481921172843f6ce1e4bb457c (patch) | |
tree | e1275b36d82705298e0b13ba2b67f74bf915bd13 | |
parent | 0f73dde5daa3df4927baaa403e279d22f9e0e29b (diff) | |
download | ruby-044387a1d7cb6e8481921172843f6ce1e4bb457c.tar.gz |
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
-rw-r--r-- | test/ruby/test_notimp.rb | 19 |
1 files changed, 10 insertions, 9 deletions
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) |