1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-14 22:33:52 -05:00

Fix $PWD changes when executing Python

Specifically, this does not play well with PWD=/proc/self/cwd
This commit is contained in:
Zach Riggle
2017-11-13 15:12:13 -06:00
parent eef042ad89
commit 19e2b9588a
4 changed files with 18 additions and 13 deletions

View File

@@ -37,10 +37,10 @@ resolve_link() {
}
realpath() {
local cwd="$PWD"
local path="$1"
local name
# Use a subshell to avoid changing the current path
(
while [ -n "$path" ]; do
name="${path##*/}"
[ "$name" = "$path" ] || cd "${path%/*}"
@@ -48,7 +48,7 @@ realpath() {
done
echo "${PWD}/$name"
cd "$cwd"
)
}
fi