diff options
| author | Mike McQuaid | 2016-05-23 14:36:25 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2016-05-23 14:36:25 +0100 |
| commit | 8ecfab8a598be15e7aa66e334b0ff92700943d1d (patch) | |
| tree | 3e1f1df7b738d5e6d77f58d6ea78cfab4b4f7142 /Library/Homebrew/utils | |
| parent | d345483de164e062727f95d3fbd575433d735548 (diff) | |
| download | brew-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/utils')
| -rw-r--r-- | Library/Homebrew/utils/lock.sh | 7 |
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" |
