Fail test if child process exists non-zero
This commit is contained in:
parent
8f952a1178
commit
be6954f5d4
Notes:
git
2025-03-26 02:14:43 +00:00
@ -85,13 +85,18 @@ assert_equal 'ok', %q{
|
|||||||
10.times do
|
10.times do
|
||||||
pid = fork{ exit!(0) }
|
pid = fork{ exit!(0) }
|
||||||
deadline = now + 10
|
deadline = now + 10
|
||||||
until Process.waitpid(pid, Process::WNOHANG)
|
while true
|
||||||
|
_, status = Process.waitpid2(pid, Process::WNOHANG)
|
||||||
|
break if status
|
||||||
if now > deadline
|
if now > deadline
|
||||||
Process.kill(:KILL, pid)
|
Process.kill(:KILL, pid)
|
||||||
raise "failed"
|
raise "failed"
|
||||||
end
|
end
|
||||||
sleep 0.001
|
sleep 0.001
|
||||||
end
|
end
|
||||||
|
unless status.success?
|
||||||
|
raise "child exited with status #{status}"
|
||||||
|
end
|
||||||
rescue NotImplementedError
|
rescue NotImplementedError
|
||||||
end
|
end
|
||||||
:ok
|
:ok
|
||||||
|
Loading…
x
Reference in New Issue
Block a user