mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Improve rbenv init
instructions for fish
Fish user config file `~/.config/fish/config.fish` loads for every instance of fish shell, not just interactive ones. Since it's unnecessary and dangerous to eval `rbenv init -` output in non-interactive shells, wrap the invocation in a conditional that checks if the current shell is interactive. Fixes #501
This commit is contained in:
parent
95a039aaaa
commit
be5e1a4ded
2 changed files with 7 additions and 1 deletions
|
@ -77,7 +77,7 @@ if [ -z "$print" ]; then
|
|||
echo
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo '. (rbenv init -|psub)'
|
||||
echo 'status --is-interactive; and . (rbenv init -|psub)'
|
||||
;;
|
||||
* )
|
||||
echo 'eval "$(rbenv init -)"'
|
||||
|
|
|
@ -38,6 +38,12 @@ load test_helper
|
|||
assert_line ". '${root}/libexec/../completions/rbenv.fish'"
|
||||
}
|
||||
|
||||
@test "fish instructions" {
|
||||
run rbenv-init fish
|
||||
assert [ "$status" -eq 1 ]
|
||||
assert_line 'status --is-interactive; and . (rbenv init -|psub)'
|
||||
}
|
||||
|
||||
@test "option to skip rehash" {
|
||||
run rbenv-init - --no-rehash
|
||||
assert_success
|
||||
|
|
Loading…
Reference in a new issue