mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
fix exec fails for invalid version
This commit is contained in:
parent
4b6ab0389b
commit
400fe31061
2 changed files with 8 additions and 1 deletions
|
@ -21,7 +21,7 @@ if [ "$1" = "--complete" ]; then
|
||||||
exec rbenv shims --short
|
exec rbenv shims --short
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export RBENV_VERSION="$(rbenv-version-name)"
|
RBENV_VERSION="$(rbenv-version-name)"
|
||||||
RBENV_COMMAND="$1"
|
RBENV_COMMAND="$1"
|
||||||
|
|
||||||
if [ -z "$RBENV_COMMAND" ]; then
|
if [ -z "$RBENV_COMMAND" ]; then
|
||||||
|
@ -29,6 +29,7 @@ if [ -z "$RBENV_COMMAND" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export RBENV_VERSION
|
||||||
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
|
RBENV_COMMAND_PATH="$(rbenv-which "$RBENV_COMMAND")"
|
||||||
RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
|
RBENV_BIN_PATH="${RBENV_COMMAND_PATH%/*}"
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,12 @@ create_executable() {
|
||||||
chmod +x "${bin}/$1"
|
chmod +x "${bin}/$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "fails with invalid version" {
|
||||||
|
export RBENV_VERSION="2.0"
|
||||||
|
run rbenv-exec ruby -v
|
||||||
|
assert_failure "rbenv: version \`2.0' is not installed"
|
||||||
|
}
|
||||||
|
|
||||||
@test "supports hook path with spaces" {
|
@test "supports hook path with spaces" {
|
||||||
hook_path="${RBENV_TEST_DIR}/custom stuff/rbenv hooks"
|
hook_path="${RBENV_TEST_DIR}/custom stuff/rbenv hooks"
|
||||||
mkdir -p "${hook_path}/exec"
|
mkdir -p "${hook_path}/exec"
|
||||||
|
|
Loading…
Reference in a new issue