diff options
| author | Markus Reiter | 2017-05-29 19:27:58 +0200 |
|---|---|---|
| committer | GitHub | 2017-05-29 19:27:58 +0200 |
| commit | 3165fd2519c41a2be7e12442a5098d3b699fda04 (patch) | |
| tree | 8fe6d59eaee43cdf7c35b17810477eaca0e018ad /Library/Homebrew/cask/lib/hbc/cli | |
| parent | 0a02d1a0298b99414e72b00f8405dd7c18982ce7 (diff) | |
| parent | fd97e88b990b4804e9cfec90e3e5fe60fa54437a (diff) | |
| download | brew-3165fd2519c41a2be7e12442a5098d3b699fda04.tar.bz2 | |
Merge pull request #2663 from reitermarkus/lockfile
Convert `FormulaLock` to more generic `LockFile`.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/cleanup.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb index e25393230..40b37dd5d 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/cleanup.rb @@ -75,14 +75,18 @@ module Hbc paths.each do |item| next unless item.exist? processed_files += 1 - if Utils.file_locked?(item) + + begin + LockFile.new(item.basename).with_lock do + puts item + item_size = File.size?(item) + cleanup_size += item_size unless item_size.nil? + item.unlink + end + rescue OperationInProgressError puts "skipping: #{item} is locked" next end - puts item - item_size = File.size?(item) - cleanup_size += item_size unless item_size.nil? - item.unlink end if processed_files.zero? |
