Skip to content
Snippets Groups Projects
Commit 8ecfab8a authored by Mike McQuaid's avatar Mike McQuaid
Browse files

utils/lock.sh: default to system Ruby if available (#271)

This avoids weird issues with custom Rubies.

Closes #253.
parent d345483d
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment