We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8c3cce9 commit 52c830cCopy full SHA for 52c830c
1 file changed
plugins/poetry-env/poetry-env.plugin.zsh
@@ -15,7 +15,12 @@ _togglePoetryShell() {
15
# Activate the environment if in a Poetry directory and no environment is currently active
16
if [[ $in_poetry_dir -eq 1 ]] && [[ $poetry_active -ne 1 ]]; then
17
venv_dir=$(poetry env info --path 2>/dev/null)
18
- if [[ -n "$venv_dir" ]]; then
+ # Handle case where poetry returns "." for in-project virtual environments
19
+ if [[ "$venv_dir" == "." ]]; then
20
+ venv_dir="$PWD/.venv"
21
+ fi
22
+ # Only proceed if venv_dir is set and the activate script exists
23
+ if [[ -n "$venv_dir" && -f "${venv_dir}/bin/activate" ]]; then
24
export poetry_active=1
25
export poetry_dir="$PWD"
26
source "${venv_dir}/bin/activate"
0 commit comments