mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00

FormulaInstaller now attempts to take a lock on a "foo.brewing" file for the formula and all of its dependencies before attempting installation. The lock is an advisory lock implemented using flock(), and as such it only locks out other processes that attempt to take the lock. It also means that it is never necessary to manually remove the lock file, because the lock is not enforced by I/O. The uninstall, link, and unlink commands all learn to respect this lock as well, so that the installation cannot be corrupted by a concurrent Homebrew process, and keg operations cannot occur simultaneously.
13 lines
247 B
Ruby
13 lines
247 B
Ruby
module Homebrew extend self
|
|
def unlink
|
|
raise KegUnspecifiedError if ARGV.named.empty?
|
|
|
|
ARGV.kegs.each do |keg|
|
|
keg.lock do
|
|
print "Unlinking #{keg}... "
|
|
puts "#{keg.unlink} links removed"
|
|
end
|
|
end
|
|
end
|
|
end
|