aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils/lock.sh
diff options
context:
space:
mode:
authorXu Cheng2016-06-08 17:29:03 +0800
committerXu Cheng2016-06-08 17:29:03 +0800
commit8d64b6a02d78811f50d5f747ce10df09d54b4791 (patch)
treeba5b5f2691569591fb98c6a4a81c9c8ac676882e /Library/Homebrew/utils/lock.sh
parent21ca138edf584daebf1795a52d6edd6ec34ce605 (diff)
downloadbrew-8d64b6a02d78811f50d5f747ce10df09d54b4791.tar.bz2
introduce global lock directory (#337)
Since #292, HOMEBREW_CACHE was moved to a per-user directory. This makes it unsuitable to store global lock files on multiple users environment. Therefore, introducing a global lock directory `/Library/Lock.d` to store lock files from formula lockers as well as `brew update`.
Diffstat (limited to 'Library/Homebrew/utils/lock.sh')
-rw-r--r--Library/Homebrew/utils/lock.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/lock.sh b/Library/Homebrew/utils/lock.sh
index b8e3f61ad..4ff8dc060 100644
--- a/Library/Homebrew/utils/lock.sh
+++ b/Library/Homebrew/utils/lock.sh
@@ -3,7 +3,9 @@
# Noted due to the fixed FD, a shell process can only create one lock.
lock() {
local name="$1"
- local lock_file="/tmp/homebrew${HOMEBREW_REPOSITORY//\//-}-${name}.lock"
+ local lock_dir="$HOMEBREW_LIBRARY/Locks"
+ local lock_file="$lock_dir/$name"
+ [[ -d "$lock_dir" ]] || mkdir -p "$lock_dir"
# 200 is the file descriptor used in the lock.
# This FD should be used exclusively for lock purpose.
# Any value except 0(stdin), 1(stdout) and 2(stderr) can do the job.