From e0f99945421243bc332002dec4f8e25220237aeb Mon Sep 17 00:00:00 2001 From: Forrest Fleming Date: Sat, 26 Sep 2015 00:24:23 -0700 Subject: [PATCH] Remove incomplete files in cache on `brew cleanup` Closes Homebrew/homebrew#44182. Closes Homebrew/homebrew#44349. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/cleanup.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb index 0561510cb9..ff9cd96ccb 100644 --- a/Library/Homebrew/cmd/cleanup.rb +++ b/Library/Homebrew/cmd/cleanup.rb @@ -57,6 +57,10 @@ module Homebrew def cleanup_cache return unless HOMEBREW_CACHE.directory? HOMEBREW_CACHE.children.each do |path| + if path.to_s.end_with? ".incomplete" + cleanup_path(path) { path.unlink } + next + end if prune?(path) if path.file? cleanup_path(path) { path.unlink }