Skip to content

Commit

Permalink
Only delete cached gem when it's corrupted
Browse files Browse the repository at this point in the history
Rescuing all errors here might end up hiding other errors if the
deletion of the cached gem itself raises an error for some reason. Let's
be more conservative.
  • Loading branch information
deivid-rodriguez committed Oct 27, 2021
1 parent eb46bde commit 3d80dfb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/source/rubygems.rb
Expand Up @@ -162,7 +162,7 @@ def install(spec, opts = {})
begin
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
spec.__swap__(s)
rescue StandardError
rescue Gem::Package::FormatError
Bundler.rm_rf(path)
raise
end
Expand Down

0 comments on commit 3d80dfb

Please sign in to comment.