Skip to content

Instantly share code, notes, and snippets.

@davekonopka
Created March 9, 2013 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davekonopka/5123917 to your computer and use it in GitHub Desktop.
Save davekonopka/5123917 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment