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