1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-16 07:13:53 -05:00

Reliably detect parent shell in pyenv init (fixes #93)

Imported changes from sstephenson/rbenv#453.
This commit is contained in:
Yamashita Yuu
2013-12-26 13:48:43 +09:00
parent 6efb3c327f
commit 5bff9c773a
3 changed files with 23 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ if [ "$1" = "--complete" ]; then
exec pyenv-rehash --complete
fi
shell="$(basename "$SHELL")"
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
# When pyenv shell integration is enabled, delegate to pyenv-rehash,
# then tell the shell to empty its command lookup cache.
@@ -15,11 +15,9 @@ pyenv-rehash
case "$shell" in
fish )
or='; or'
# no rehash support
;;
* )
or='||'
echo "hash -r 2>/dev/null || true"
;;
esac
echo "hash -r 2>/dev/null $or true"