From 99d35f201c9d9ef1cadeac5f1f7b5394f783935e Mon Sep 17 00:00:00 2001 From: Chris Caldwell Date: Tue, 21 Apr 2026 09:53:01 -0600 Subject: [PATCH] Fix POSIX sh (dash) compatibility in pyenv-virtualenv-init (#526) * Refactor cache code generation * Don't generate prompt_command for non bash/zsh/fish --------- Co-authored-by: Ivan Pozdeev --- bin/pyenv-virtualenv-init | 95 +++++++++++++++++++-------------------- test/init.bats | 28 +++++++----- 2 files changed, 61 insertions(+), 62 deletions(-) diff --git a/bin/pyenv-virtualenv-init b/bin/pyenv-virtualenv-init index 138fb48..03feec7 100755 --- a/bin/pyenv-virtualenv-init +++ b/bin/pyenv-virtualenv-init @@ -120,22 +120,13 @@ esac case "$shell" in fish ) - if [ -n "$_has_version_hooks" ]; then - cat </dev/null) +EOS + fi + + cat </dev/null)" - return \$ret -}; EOS fi - case "$shell" in - bash ) - cat <