diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-03-25 12:06:39 -0700 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-03-25 19:14:26 -0700 |
| commit | be6954f5d466f4b274505e4f14bcad291d0b0989 (patch) | |
| tree | edcb638b74d758e388f394f17388c943f128e51f | |
| parent | 8f952a117870d2a3284a33988aa23e7af3a3a2d3 (diff) | |
Fail test if child process exists non-zero
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12981
| -rw-r--r-- | bootstraptest/test_fork.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bootstraptest/test_fork.rb b/bootstraptest/test_fork.rb index a54316dbca..860ef285d0 100644 --- a/bootstraptest/test_fork.rb +++ b/bootstraptest/test_fork.rb @@ -85,13 +85,18 @@ assert_equal 'ok', %q{ 10.times do pid = fork{ exit!(0) } deadline = now + 10 - until Process.waitpid(pid, Process::WNOHANG) + while true + _, status = Process.waitpid2(pid, Process::WNOHANG) + break if status if now > deadline Process.kill(:KILL, pid) raise "failed" end sleep 0.001 end + unless status.success? + raise "child exited with status #{status}" + end rescue NotImplementedError end :ok |
