aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMike McQuaid2016-05-23 14:36:25 +0100
committerMike McQuaid2016-05-23 14:36:25 +0100
commit8ecfab8a598be15e7aa66e334b0ff92700943d1d (patch)
tree3e1f1df7b738d5e6d77f58d6ea78cfab4b4f7142 /Library/Homebrew
parentd345483de164e062727f95d3fbd575433d735548 (diff)
downloadbrew-8ecfab8a598be15e7aa66e334b0ff92700943d1d.tar.bz2
utils/lock.sh: default to system Ruby if available (#271)
This avoids weird issues with custom Rubies. Closes #253.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/utils/lock.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/Library/Homebrew/utils/lock.sh b/Library/Homebrew/utils/lock.sh
index 97cf28219..b8e3f61ad 100644
--- a/Library/Homebrew/utils/lock.sh
+++ b/Library/Homebrew/utils/lock.sh
@@ -26,9 +26,12 @@ EOS
_create_lock() {
local lock_fd="$1"
- if [[ -n "$(which ruby)" ]]
+ local ruby="/usr/bin/ruby"
+ [[ -x "$ruby" ]] || local ruby="$(which ruby 2>/dev/null)"
+
+ if [[ -n "$ruby" ]]
then
- ruby -e "File.new($lock_fd).flock(File::LOCK_EX | File::LOCK_NB) || exit(1)"
+ "$ruby" -e "File.new($lock_fd).flock(File::LOCK_EX | File::LOCK_NB) || exit(1)"
elif [[ -n "$(which flock)" ]]
then
flock -n "$lock_fd"