Make sure to wait for the thread to exit in TestProcess#test_wait_and_sigchild

This commit is contained in:
Naoto Ono 2024-08-13 13:48:01 +09:00 committed by Koichi Sasada
parent d5afa2cc95
commit 436d23f80d
Notes: git 2024-08-13 05:48:06 +00:00

View File

@ -1732,15 +1732,20 @@ class TestProcess < Test::Unit::TestCase
sig_w.write('?')
end
pid = nil
th = nil
IO.pipe do |r, w|
pid = fork { r.read(1); exit }
Thread.start {
th = Thread.start {
Thread.current.report_on_exception = false
raise
}
w.puts
end
Process.wait pid
begin
th.join
rescue Exception
end
assert_send [sig_r, :wait_readable, 5], 'self-pipe not readable'
end
if defined?(RubyVM::RJIT) && RubyVM::RJIT.enabled? # checking -DRJIT_FORCE_ENABLE. It may trigger extra SIGCHLD.