diff options
author | Ellen Marie Dash <me@duckie.co> | 2022-06-30 20:28:33 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-12-02 19:21:08 +0000 |
commit | 82b86b4c97963d25c4e8ba12aab327d47c1f5861 (patch) | |
tree | 5d3b0be16a728681b61f42958753cd5981ed8ae5 /lib/rubygems.rb | |
parent | 5fafff15c606dd4ad323cc9a9c75776ab9536d54 (diff) | |
download | ruby-82b86b4c97963d25c4e8ba12aab327d47c1f5861.tar.gz |
[rubygems/rubygems] Delete partial file and re-raise on Errno::ENOSPC.
Add test for not leaving empty files if ENOSPC is raised during 'gem install'
https://github.com/rubygems/rubygems/commit/8e0e20f079
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r-- | lib/rubygems.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index a869fc4c45..0c0ca9c1ba 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -774,6 +774,10 @@ An Array (#{env.inspect}) was passed in from #{caller[3]} open_file(path, "wb") do |io| io.write data end + rescue Errno::ENOSPC + # If we ran out of space but the file exists, it's *guaranteed* to be corrupted. + File.delete(path) if File.exist?(path) + raise end ## |