Prepend $PATH with the command's dirname before execing for compatibility with ruby -S

This commit is contained in:
Sam Stephenson 2011-08-05 10:12:58 -05:00
parent 2fa7432060
commit 2a495dc9ac

View file

@ -7,6 +7,7 @@ if [ -z "$RBENV_COMMAND" ]; then
fi fi
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")" RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
shopt -s nullglob shopt -s nullglob
RBENV_EXEC_PLUGINS=(/etc/rbenv.d/exec/*.bash ${HOME}/.rbenv/rbenv.d/exec/*.bash) RBENV_EXEC_PLUGINS=(/etc/rbenv.d/exec/*.bash ${HOME}/.rbenv/rbenv.d/exec/*.bash)
@ -17,4 +18,5 @@ for script in ${RBENV_EXEC_PLUGINS[@]}; do
done done
shift 1 shift 1
export PATH="${RBENV_BIN_PATH}:${PATH}"
exec -a "$RBENV_COMMAND" "$RBENV_COMMAND_PATH" "$@" exec -a "$RBENV_COMMAND" "$RBENV_COMMAND_PATH" "$@"