Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4075 - bundler:reraise-orig-exception, r=segiddins
Browse files Browse the repository at this point in the history
Fix Gem::SystemExitException initialization

Previously, we would attempt to initialize `Gem::SystemExitException`
without an argument, which would result in an `ArgumentError` since the
argument is required (from Rubygems 1.3 all the way to 2.4).

I don't know how we missed this all this time. Maybe that path is not
even hit anymore.

Anyway, we don't even have to initialize a new exception, just re-raising the
one we've rescued is sufficient.
  • Loading branch information
homu committed Oct 27, 2015
2 parents 25a979c + 1f1f748 commit 2ba15dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bundler/rubygems_integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def configuration
rescue Gem::SystemExitException => e
Bundler.ui.error "#{e.class}: #{e.message}"
Bundler.ui.trace e
raise Gem::SystemExitException
raise
end

def ruby_engine
Expand Down
7 changes: 7 additions & 0 deletions spec/bundler/rubygems_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@
Bundler.rubygems.validate(spec)
end
end

describe "#configuration" do
it "handles Gem::SystemExitException errors" do
allow(Gem).to receive(:configuration) { raise Gem::SystemExitException.new(1) }
expect { Bundler.rubygems.configuration }.to raise_error(Gem::SystemExitException)
end
end
end

0 comments on commit 2ba15dc

Please sign in to comment.