Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

at_exit: don't mask nonzero exit status due to $!

This change ensures that RSpec's at_exit handler doesn't mask (override)
any nonzero exit status, which can happen when Ruby is on it's way out
due to an uncaught exception ($!) such as a SyntaxError.

Please see this bug report for more information:

sunaku/tork#31 (comment)
  • Loading branch information...
commit e7fdaaa44633306f7f0ec150e8a137e009381c2b 1 parent 5686c13
@sunaku sunaku authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/rspec/core/runner.rb
2  lib/rspec/core/runner.rb
@@ -7,7 +7,7 @@ class Runner
# Register an at_exit hook that runs the suite.
def self.autorun
return if autorun_disabled? || installed_at_exit? || running_in_drb?
- at_exit { exit run(ARGV, $stderr, $stdout).to_i }
+ at_exit { exit run(ARGV, $stderr, $stdout).to_i unless $! }
@installed_at_exit = true
AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
Please sign in to comment.
Something went wrong with that request. Please try again.