Merge pull request #4700 from reitermarkus/hide-lockfile-cleanup

Hide lockfiles being cleaned up.
This commit is contained in:
Markus Reiter 2018-08-16 15:17:18 +02:00 committed by GitHub
commit 880f6fa509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -245,9 +245,9 @@ module Homebrew
end
def cleanup_lockfiles(*lockfiles)
return unless HOMEBREW_LOCK_DIR.directory?
return if dry_run?
if lockfiles.empty?
if lockfiles.empty? && HOMEBREW_LOCK_DIR.directory?
lockfiles = HOMEBREW_LOCK_DIR.children.select(&:file?)
end
@ -256,7 +256,7 @@ module Homebrew
next unless file.open(File::RDWR).flock(File::LOCK_EX | File::LOCK_NB)
begin
cleanup_path(file) { file.unlink }
file.unlink
ensure
file.open(File::RDWR).flock(File::LOCK_UN) if file.exist?
end