diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2024-05-29 11:46:33 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2024-05-29 11:46:33 -0700 |
| commit | 6e46a363a8f29d93cf6992805ee67d029cea030f (patch) | |
| tree | 95f588022126443b2184282eadd5d9320e7a0818 /test/ruby | |
| parent | 541fc816fcb697307d666fed644ddd07ca5e942e (diff) | |
merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]
Don't clear pending interrupts in the parent process. (#10365)
Diffstat (limited to 'test/ruby')
| -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 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 |
