diff options
author | Samuel Williams <[email protected]> | 2024-03-27 10:10:07 +1300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-27 10:10:07 +1300 |
commit | a7ff264477105b5dc0ade6facad4176a1b73df0b (patch) | |
tree | 6b045c951f65e2a767395667e3f8d5b4f14a3dbd /test | |
parent | 0c62eb25b5c7a2ce6764e81bf98ac39a804a3721 (diff) |
Don't clear pending interrupts in the parent process. (#10365)
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_process.rb | 21 |
1 files changed, 21 insertions, 0 deletions
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 |