Skip to content

Instantly share code, notes, and snippets.

@nelix
Created July 25, 2013 02:20
Show Gist options
  • Select an option

  • Save nelix/6076406 to your computer and use it in GitHub Desktop.

Select an option

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.
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
@nelix
Copy link
Copy Markdown
Author

nelix commented Jul 25, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment