mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-22 21:22:38 +00:00
Avoid slow abs_dirname()
by loading realpath
extension
This speeds up every `rbenv` invocation significantly.
This commit is contained in:
parent
284588f9b4
commit
5287e2ebf4
1 changed files with 7 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue