From a7ff264477105b5dc0ade6facad4176a1b73df0b Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 27 Mar 2024 10:10:07 +1300 Subject: Don't clear pending interrupts in the parent process. (#10365) --- test/ruby/test_process.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 8982ab8b9a..59140ba664 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -2828,4 +2828,25 @@ EOS [t1, t2, t3].each { _1&.join rescue nil } [long_rpipe, long_wpipe, short_rpipe, short_wpipe].each { _1&.close rescue nil } end if defined?(fork) + + def test_handle_interrupt_with_fork + Thread.handle_interrupt(RuntimeError => :never) do + Thread.current.raise(RuntimeError, "Queued error") + + assert_predicate Thread, :pending_interrupt? + + pid = Process.fork do + if Thread.pending_interrupt? + exit 1 + end + end + + _, status = Process.waitpid2(pid) + assert_predicate status, :success? + + assert_predicate Thread, :pending_interrupt? + end + rescue RuntimeError + # Ignore. + end if defined?(fork) end -- cgit v1.2.3