mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
commit
d51f6d4376
2 changed files with 15 additions and 3 deletions
|
@ -33,9 +33,9 @@ done
|
||||||
|
|
||||||
shell="$1"
|
shell="$1"
|
||||||
if [ -z "$shell" ]; then
|
if [ -z "$shell" ]; then
|
||||||
shell="$(ps c -p "$PPID" -o 'ucomm=' 2>/dev/null || true)"
|
shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)"
|
||||||
shell="${shell##-}"
|
|
||||||
shell="${shell%% *}"
|
shell="${shell%% *}"
|
||||||
|
shell="${shell##-}"
|
||||||
shell="${shell:-$SHELL}"
|
shell="${shell:-$SHELL}"
|
||||||
shell="${shell##*/}"
|
shell="${shell##*/}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -25,12 +25,24 @@ load test_helper
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "detect parent shell" {
|
@test "detect parent shell" {
|
||||||
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
|
||||||
SHELL=/bin/false run rbenv-init -
|
SHELL=/bin/false run rbenv-init -
|
||||||
assert_success
|
assert_success
|
||||||
assert_line "export RBENV_SHELL=bash"
|
assert_line "export RBENV_SHELL=bash"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "detect parent shell from script" {
|
||||||
|
mkdir -p "$RBENV_TEST_DIR"
|
||||||
|
cd "$RBENV_TEST_DIR"
|
||||||
|
cat > myscript.sh <<OUT
|
||||||
|
#!/bin/sh
|
||||||
|
eval "\$(rbenv-init -)"
|
||||||
|
echo \$RBENV_SHELL
|
||||||
|
OUT
|
||||||
|
chmod +x myscript.sh
|
||||||
|
run ./myscript.sh /bin/zsh
|
||||||
|
assert_success "sh"
|
||||||
|
}
|
||||||
|
|
||||||
@test "setup shell completions (fish)" {
|
@test "setup shell completions (fish)" {
|
||||||
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||||
run rbenv-init - fish
|
run rbenv-init - fish
|
||||||
|
|
Loading…
Reference in a new issue