Created
July 25, 2013 02:20
-
-
Save nelix/6076406 to your computer and use it in GitHub Desktop.
Fix the case where random gems think fucking with at_exit is an OK thing todo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9" | |
| module Kernel | |
| alias :__at_exit :at_exit | |
| def at_exit(&block) | |
| __at_exit do | |
| exit_status = $!.status if $!.is_a?(SystemExit) | |
| block.call | |
| exit exit_status if exit_status | |
| end | |
| end | |
| end | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
btw: http://www.davekonopka.com/2013/rspec-exit-code.html