From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2026-07-12T10:38:41+00:00 Subject: [ruby-core:126062] [Ruby Bug#22191] `Signal.trap(:EXIT)` exception only shown if `at_exit` also raises Issue #22191 has been updated by nobu (Nobuyoshi Nakada). Related bug: when two `END` raise exceptions, the same message is printed multiple times. ```console $ ruby -e 'END{raise "END1"};END{raise "END2"}' -e:1:in 'block (2 levels) in
': END2 (RuntimeError) -e:1:in 'block (2 levels) in
': END1 (RuntimeError) -e:1:in 'block (2 levels) in
': END2 (RuntimeError) ``` ```console $ ruby -e 'END{raise "END1"};END{raise "END2"};END{raise "END3"}' -e:1:in 'block (2 levels) in
': END3 (RuntimeError) -e:1:in 'block (2 levels) in
': END2 (RuntimeError) -e:1:in 'block (2 levels) in
': END3 (RuntimeError) -e:1:in 'block (2 levels) in
': END1 (RuntimeError) -e:1:in 'block (2 levels) in
': END2 (RuntimeError) -e:1:in 'block (2 levels) in
': END3 (RuntimeError) ``` ---------------------------------------- Bug #22191: `Signal.trap(:EXIT)` exception only shown if `at_exit` also raises https://bugs.ruby-lang.org/issues/22191#change-118062 * Author: Earlopain (Earlopain _) * Status: Open * ruby -v: ruby 4.1.0dev (2026-05-29T14:34:40Z master 7a07a54298) +PRISM [x86_64-linux] * Backport: 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED ---------------------------------------- ```rb Signal.trap(:EXIT, proc { raise "foo" }) # No output ``` ```rb Signal.trap(:EXIT, proc { raise "foo" }) at_exit { raise "bar" } # test.rb:2:in 'block in
': bar (RuntimeError) # test.rb:1:in 'block in
': foo (RuntimeError) ``` A bit weird -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/