Skip to content

Commit b30bcbc

Browse files
parndthsbtkou
authored
Check for file existence before deletion from cache (#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> --------- Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
1 parent 4eb66d9 commit b30bcbc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bundler/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)