From 6e46a363a8f29d93cf6992805ee67d029cea030f Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 29 May 2024 11:46:33 -0700 Subject: merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393] 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 188ef75fae..d9804aaa57 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -2783,4 +2783,25 @@ EOS assert_operator(GC.stat(:total_freed_pages), :>, 0) end; end + + 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