bail out early if readlink is not available

readlink comes from GNU coreutils.  On systems without it, rbenv used to
spin out of control when it didn't have readlink or greadlink available
because it would re-exec the frontend script over and over instead of the
worker script in libexec.

Fixes #389
This commit is contained in:
James FitzGibbon 2013-05-10 14:20:16 -07:00 committed by Mislav Marohnić
parent e93ab45dc3
commit 81bb14e181
3 changed files with 21 additions and 3 deletions

View file

@ -12,8 +12,14 @@ if [ -n "$RBENV_DEBUG" ]; then
set -x
fi
READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi
resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
$READLINK "$1"
}
abs_dirname() {

View file

@ -19,8 +19,14 @@ if [ -z "$RBENV_COMMAND" ]; then
exit 1
fi
READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi
resolve_link() {
$(type -p greadlink readlink | head -1) $1
$READLINK "$1"
}
realpath() {

View file

@ -25,8 +25,14 @@ if [ -z "$shell" ]; then
shell="$(basename "$SHELL")"
fi
READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi
resolve_link() {
$(type -p greadlink readlink | head -1) $1
$READLINK "$1"
}
abs_dirname() {