mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
0f73dde5da
commit
044387a1d7
1 changed files with 10 additions and 9 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue