mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-14 14:23:53 -05:00
Avoid slow abs_dirname() by loading realpath extension
This speeds up every `rbenv` invocation significantly.
This commit is contained in:
@@ -12,6 +12,12 @@ if [ -n "$RBENV_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
if enable -f "${0%/*}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then
|
||||
abs_dirname() {
|
||||
local path="$(realpath "$1")"
|
||||
echo "${path%/*}"
|
||||
}
|
||||
else
|
||||
READLINK=$(type -p greadlink readlink | head -1)
|
||||
if [ -z "$READLINK" ]; then
|
||||
echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
|
||||
@@ -35,6 +41,7 @@ abs_dirname() {
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
fi
|
||||
|
||||
if [ -z "${RBENV_ROOT}" ]; then
|
||||
RBENV_ROOT="${HOME}/.rbenv"
|
||||
|
||||
Reference in New Issue
Block a user