Skip to content

Commit

Permalink
avoid a couple fork/execs
Browse files Browse the repository at this point in the history
  • Loading branch information
ap committed Nov 11, 2015
1 parent d1e7699 commit 5da835c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libexec/plenv-commands
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ shopt -s nullglob
fi
done
done
} | sort | uniq
} | sort -u
5 changes: 3 additions & 2 deletions libexec/plenv-init
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ done

shell="$1"
if [ -z "$shell" ]; then
shell="$(ps c -p $(ps -p $$ -o 'ppid=' 2>/dev/null) -o 'comm=' 2>/dev/null || true)"
shell="$(ps c -p $PPID -o 'comm=' 2>/dev/null || true)"
shell="${shell##-}"
shell="$(basename "${shell:-$SHELL}")"
shell="${shell:-$SHELL}"
shell="${shell##*/}"
fi

READLINK=$(type -p greadlink readlink | while read line; do echo $line; break; done)
Expand Down
3 changes: 2 additions & 1 deletion libexec/plenv-sh-rehash
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ if [ "$1" = "--complete" ]; then
exec plenv-rehash --complete
fi

shell="($basename "${PLENV_SHELL:-$SHELL}")"
shell="${PLENV_SHELL:-$SHELL}"
shell="${shell##*/}"

# When plenv shell integration is enabled, delegate to plenv-rehash,
# then tell the shell to empty its command lookup cache.
Expand Down
3 changes: 2 additions & 1 deletion libexec/plenv-sh-shell
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ if [ "$1" = "--complete" ]; then
fi

version="$1"
shell="$(basename "${PLENV_SHELL:-$SHELL}")"
shell="${PLENV_SHELL:-$SHELL}"
shell="${shell##*/}"

if [ -z "$version" ]; then
if [ -z "$PLENV_VERSION" ]; then
Expand Down

0 comments on commit 5da835c

Please sign in to comment.