Skip to content

Commit 451c120

Browse files
parndthsbtkou
authored andcommitted
[ruby/rubygems] Check for file existence before deletion from cache
(ruby/rubygems#9095) * Rescue when deleting a non-existent cached gem file When a gem was in the cache, but another process deletes it first, this delete command fails. To work around this, I'm rescuing from Errno::ENOENT and swalling the error. The file is gone, and we can move on. * Apply suggestion from @kou Co-authored-by: Sutou Kouhei <kou@cozmixng.org> --------- ruby/rubygems@b30bcbc648 Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
1 parent ee002a5 commit 451c120

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/bundler/runtime.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,11 @@ def prune_gem_cache(resolve, cache_path)
240240

241241
cached.each do |path|
242242
Bundler.ui.info " * #{File.basename(path)}"
243-
File.delete(path)
243+
244+
begin
245+
File.delete(path)
246+
rescue Errno::ENOENT
247+
end
244248
end
245249
end
246250
end

0 commit comments

Comments
 (0)