Actions
Bug #22191
closed`Signal.trap(:EXIT)` exception only shown if `at_exit` also raises
Bug #22191:
`Signal.trap(:EXIT)` exception only shown if `at_exit` also raises
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-05-29T14:34:40Z master 7a07a54298) +PRISM [x86_64-linux]
Updated by nobu (Nobuyoshi Nakada) 2 days ago
- Backport changed from 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN to 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED
Updated by nobu (Nobuyoshi Nakada) 2 days ago
Related bug: when two END raise exceptions, the same message is printed multiple times.
$ ruby -e 'END{raise "END1"};END{raise "END2"}'
-e:1:in 'block (2 levels) in <main>': END2 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END1 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END2 (RuntimeError)
$ ruby -e 'END{raise "END1"};END{raise "END2"};END{raise "END3"}'
-e:1:in 'block (2 levels) in <main>': END3 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END2 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END3 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END1 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END2 (RuntimeError)
-e:1:in 'block (2 levels) in <main>': END3 (RuntimeError)
Updated by nobu (Nobuyoshi Nakada) 2 days ago
- Status changed from Open to Closed
Applied in changeset git|0d7e50a1746bfa3db2a50478d3680cd7c36ea383.
[Bug #22191] Report EXIT handler exceptions after END blocks
Keep exceptions raised by EXIT traps until END handlers finish.
That leaves them available for reporting during cleanup.
Print END handler exceptions without replaying causes already
reported from earlier exit handlers. This keeps the previous handler
exception visible while avoiding duplicate diagnostics.
Updated by k0kubun (Takashi Kokubun) about 19 hours ago
- Backport changed from 3.3: REQUIRED, 3.4: REQUIRED, 4.0: REQUIRED to 3.3: REQUIRED, 3.4: REQUIRED, 4.0: DONE
ruby_4_0 42c09041fe98a932d5a2a14da861527d2d80b807 merged revision(s) 0d7e50a1746bfa3db2a50478d3680cd7c36ea383.
Actions