mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Revert "Don't duplicate shims in PATH"
Too many of our users have a shell initialization set up that
inadvertently duplicates some or most of the entries in their PATH,
bringing the system paths again in front of rbenv's shims. If this was a
nested shell (a typical scenario when starting up tmux), `rbenv init`
would get eval'd again but this time, shims won't get added to the front
of the PATH and would only stay and the end of the path, effectively
rendering them useless.
I tried to argue that this is a user problem rather than rbenv's, but I
can't fix everybody shell init when they report bugs. Instead, let's
revert to simpler times in rbenv where we just roll along with the
duplication and don't ask any questions.
This reverts commit 03fa148e81
.
Fixes #369
This commit is contained in:
parent
e851250da6
commit
e2173df4aa
3 changed files with 4 additions and 13 deletions
|
@ -92,22 +92,13 @@ fi
|
|||
|
||||
mkdir -p "${RBENV_ROOT}/"{shims,versions}
|
||||
|
||||
if [[ ":${PATH}:" != *:"${RBENV_ROOT}/shims":* ]]; then
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo "setenv PATH '${RBENV_ROOT}/shims' \$PATH"
|
||||
;;
|
||||
* )
|
||||
echo 'export PATH="'${RBENV_ROOT}'/shims:${PATH}"'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo "setenv PATH '${RBENV_ROOT}/shims' \$PATH"
|
||||
echo "setenv RBENV_SHELL $shell"
|
||||
;;
|
||||
* )
|
||||
echo 'export PATH="'${RBENV_ROOT}'/shims:${PATH}"'
|
||||
echo "export RBENV_SHELL=$shell"
|
||||
;;
|
||||
esac
|
||||
|
|
BIN
libexec/rbenv-realpath.dylib
Executable file
BIN
libexec/rbenv-realpath.dylib
Executable file
Binary file not shown.
|
@ -64,11 +64,11 @@ load test_helper
|
|||
assert_line 0 "setenv PATH '${RBENV_ROOT}/shims' \$PATH"
|
||||
}
|
||||
|
||||
@test "doesn't add shims to PATH more than once" {
|
||||
@test "can add shims to PATH more than once" {
|
||||
export PATH="${RBENV_ROOT}/shims:$PATH"
|
||||
run rbenv-init - bash
|
||||
assert_success
|
||||
refute_line 'export PATH="'${RBENV_ROOT}'/shims:${PATH}"'
|
||||
assert_line 0 'export PATH="'${RBENV_ROOT}'/shims:${PATH}"'
|
||||
}
|
||||
|
||||
@test "doesn't add shims to PATH more than once (fish)" {
|
||||
|
|
Loading…
Reference in a new issue