mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
When the ruby shim is invoked with a script, set RBENV_DIR to the script's dirname
This commit is contained in:
parent
6c1fb9ffd0
commit
283e67b57e
1 changed files with 18 additions and 1 deletions
|
@ -37,8 +37,25 @@ create_prototype_shim() {
|
|||
cat > "$PROTOTYPE_SHIM_PATH" <<SH
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
[ -n "\$RBENV_DEBUG" ] && set -x
|
||||
|
||||
program="\${0##*/}"
|
||||
if [ "\$program" = "ruby" ]; then
|
||||
for arg; do
|
||||
case "\$arg" in
|
||||
-e* | -- ) break ;;
|
||||
*/* )
|
||||
if [ -f "\$arg" ]; then
|
||||
export RBENV_DIR="\${arg%/*}"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
export RBENV_ROOT="$RBENV_ROOT"
|
||||
exec rbenv exec "\${0##*/}" "\$@"
|
||||
exec rbenv exec "\$program" "\$@"
|
||||
SH
|
||||
chmod +x "$PROTOTYPE_SHIM_PATH"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue