From d959a780d43ba2aa119f557b8750447b295c5e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?okhowang=28=E7=8E=8B=E6=B2=9B=E6=96=87=29?= Date: Fri, 22 Jun 2018 15:51:34 +0800 Subject: [PATCH] use python flock firstly --- Library/Homebrew/utils/lock.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/utils/lock.sh b/Library/Homebrew/utils/lock.sh index d8651cd754..060941d78a 100644 --- a/Library/Homebrew/utils/lock.sh +++ b/Library/Homebrew/utils/lock.sh @@ -45,12 +45,12 @@ _create_lock() { if [[ -x "$ruby" ]] && "$ruby" -e "exit(RUBY_VERSION >= '1.8.7')" then "$ruby" -e "File.new($lock_fd).flock(File::LOCK_EX | File::LOCK_NB) || exit(1)" - elif [[ -x "$(type -P flock)" ]] - then - flock -n "$lock_fd" elif [[ -x "$python" ]] then "$python" -c "import fcntl; fcntl.flock($lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)" + elif [[ -x "$(type -P flock)" ]] + then + flock -n "$lock_fd" else onoe "Cannot create $name lock, please avoid running Homebrew in parallel." fi