mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-14 06:13: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
|
||||
end
|
||||
end
|
||||
EOS
|
||||
exit 0
|
||||
;;
|
||||
ksh )
|
||||
cat <<EOS
|
||||
function rbenv {
|
||||
typeset command
|
||||
EOS
|
||||
;;
|
||||
* )
|
||||
IFS="|"
|
||||
cat <<EOS
|
||||
rbenv() {
|
||||
typeset command
|
||||
local command
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
|
||||
IFS="|"
|
||||
cat <<EOS
|
||||
command="\$1"
|
||||
if [ "\$#" -gt 0 ]; then
|
||||
shift
|
||||
@@ -142,5 +154,3 @@ rbenv() {
|
||||
esac
|
||||
}
|
||||
EOS
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user