1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Only delete cached gem when it's corrupted

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.

3d80dfba08
This commit is contained in:
David Rodríguez 2021-10-27 22:15:31 +02:00 committed by git
parent cbf2078a25
commit d8e97169ba

View file

@ -162,7 +162,7 @@ module Bundler
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