From 5577e5d396cc8f062833b67d6280db6cc8501e7a Mon Sep 17 00:00:00 2001 From: nagachika Date: Sat, 6 Jul 2024 13:26:26 +0900 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 939a4268d7..1228f2c0b1 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -2713,4 +2713,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