mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-14 14:23:53 -05:00
fix rbenv() function in ksh and dash
ksh syntax becomes:
function rbenv {
typeset command
`typeset` only declares a local variable if there's an explicit
`function` declaration; otherwise the variable leaks.
Other shells use this syntax:
rbenv() {
local command
This is for dash compatibility, which supports neither `function` nor
`typeset`.
references #205, fixes #408
This commit is contained in:
@@ -122,13 +122,25 @@ function rbenv
|
|||||||
command rbenv "\$command" \$argv
|
command rbenv "\$command" \$argv
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
EOS
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
ksh )
|
||||||
|
cat <<EOS
|
||||||
|
function rbenv {
|
||||||
|
typeset command
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
IFS="|"
|
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
rbenv() {
|
rbenv() {
|
||||||
typeset command
|
local command
|
||||||
|
EOS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
IFS="|"
|
||||||
|
cat <<EOS
|
||||||
command="\$1"
|
command="\$1"
|
||||||
if [ "\$#" -gt 0 ]; then
|
if [ "\$#" -gt 0 ]; then
|
||||||
shift
|
shift
|
||||||
@@ -142,5 +154,3 @@ rbenv() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
EOS
|
EOS
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|||||||
Reference in New Issue
Block a user