From 436d23f80da20ab56ebe42da4f37fc5c3e276f69 Mon Sep 17 00:00:00 2001 From: Naoto Ono Date: Tue, 13 Aug 2024 13:48:01 +0900 Subject: [PATCH] Make sure to wait for the thread to exit in TestProcess#test_wait_and_sigchild --- test/ruby/test_process.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index e2f82dde5e..edfb8ebe0e 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -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.