aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/cleanup.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/cleanup.rb b/Library/Homebrew/cmd/cleanup.rb
index c405c3efd..5cf7ef00e 100644
--- a/Library/Homebrew/cmd/cleanup.rb
+++ b/Library/Homebrew/cmd/cleanup.rb
@@ -10,7 +10,10 @@ module Homebrew extend self
if ARGV.named.empty?
cleanup_cellar
cleanup_cache
- rm_DS_Store unless ARGV.dry_run?
+ unless ARGV.dry_run?
+ cleanup_lockfiles
+ rm_DS_Store
+ end
else
ARGV.formulae.each { |f| cleanup_formula(f) }
end
@@ -80,6 +83,14 @@ module Homebrew extend self
end
end
+ def cleanup_lockfiles
+ candidates = HOMEBREW_CACHE_FORMULA.children
+ lockfiles = candidates.select { |f| f.file? && f.extname == '.brewing' }
+ lockfiles.select(&:readable?).each do |file|
+ file.open.flock(File::LOCK_EX | File::LOCK_NB) and file.unlink
+ end
+ end
+
def rm_DS_Store
system "find #{HOMEBREW_PREFIX} -name .DS_Store -delete 2>/dev/null"
end