Project

General

Profile

Bug #12302

at_exit status status is changed by raising/rescueing a exception in at_exit

Added by grosser (Michael Grosser) over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-core:75038]

Description

at_exit do
  puts "1 #{$!}"
end

at_exit do
  puts "2 #{$!}"
  raise 'x' rescue nil
end

at_exit do
  puts "3 #{$!}"
  exit 1
end

Nr 3 runs first and exits 1 ... Nr2 receives the correct exit status ... but using raise/rescue there overrides $! and Nr 1 thinks it is a clean exit ...

seems semi related to https://bugs.ruby-lang.org/issues/5218 ... ideally the at_exit block should restore the previous $! ... or give some other way of knowing the exit status like passing it to the block

at_exit do |exception|
   ...
end

Associated revisions

Revision 1fbe0943
Added by nobu (Nobuyoshi Nakada) over 3 years ago

eval_jump.c: restore previous error info

  • eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54681
Added by nobu (Nobuyoshi Nakada) over 3 years ago

eval_jump.c: restore previous error info

  • eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302]

Revision 54681
Added by nobu (Nobuyoshi Nakada) over 3 years ago

eval_jump.c: restore previous error info

  • eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302]

Revision 54681
Added by nobu (Nobuyoshi Nakada) over 3 years ago

eval_jump.c: restore previous error info

  • eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302]

Revision 54681
Added by nobu (Nobuyoshi Nakada) over 3 years ago

eval_jump.c: restore previous error info

  • eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302]

Revision ab3376b9
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 54681: [Backport #12302]

    * eval_jump.c (exec_end_procs_chain): restore previous error info
      for each end procs.  [ruby-core:75038] [Bug #12302]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54718
Added by nagachika (Tomoyuki Chikanaga) over 3 years ago

merge revision(s) 54681: [Backport #12302]

* eval_jump.c (exec_end_procs_chain): restore previous error info
  for each end procs.  [ruby-core:75038] [Bug #12302]

Revision ba1bd67d
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 54681: [Backport #12302]

    * eval_jump.c (exec_end_procs_chain): restore previous error info
      for each end procs.  [ruby-core:75038] [Bug #12302]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@54769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54769
Added by usa (Usaku NAKAMURA) over 3 years ago

merge revision(s) 54681: [Backport #12302]

* eval_jump.c (exec_end_procs_chain): restore previous error info
  for each end procs.  [ruby-core:75038] [Bug #12302]

History

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Description updated (diff)
  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED
#2

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset r54681.


eval_jump.c: restore previous error info

  • eval_jump.c (exec_end_procs_chain): restore previous error info for each end procs. [ruby-core:75038] [Bug #12302]

Updated by Rokki1488 (karache deyong) over 3 years ago

  • Project changed from Ruby master to Backport21
  • Assignee set to ReiOdaira (Rei Odaira)
  • Tracker changed from Bug to Backport

[removed spammer's comment and locked the account]

Updated by Rokki1488 (karache deyong) over 3 years ago

[removed spammer's comment and locked the account]

Updated by usa (Usaku NAKAMURA) over 3 years ago

  • Tracker changed from Backport to Bug
  • Project changed from Backport21 to Ruby master
  • ruby -v set to -
  • Backport set to 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) over 3 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE

ruby_2_3 r54718 merged revision(s) 54681.

Updated by usa (Usaku NAKAMURA) over 3 years ago

  • Backport changed from 2.1: REQUIRED, 2.2: REQUIRED, 2.3: DONE to 2.1: REQUIRED, 2.2: DONE, 2.3: DONE

ruby_2_2 r54769 merged revision(s) 54681.

Also available in: Atom PDF