summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2024-07-06 13:26:26 +0900
committernagachika <nagachika@ruby-lang.org>2024-07-06 13:26:26 +0900
commit5577e5d396cc8f062833b67d6280db6cc8501e7a (patch)
tree5b762eec93ceb2bdd5978f371ebb84231731637c /test
parent2f8f17e842666abb05ca522d6072c957fab0e12e (diff)
merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]
Don't clear pending interrupts in the parent process. (#10365)
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_process.rb21
1 files changed, 21 insertions, 0 deletions
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