diff options
| author | Zikoeng Xi <github@zikoengxi.com> | 2024-03-26 16:54:04 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-26 09:54:04 +0100 |
| commit | a168efe73e467c7164ef9b49dea61e9aefd27a48 (patch) | |
| tree | ba3f4aa9cbe8f3a0517bbbd6481b99098dbc0521 /plugins/poetry-env | |
| parent | ecc3e9db8adba668f9109647bc9fbbdec513de8a (diff) | |
| download | zsh-a168efe73e467c7164ef9b49dea61e9aefd27a48.tar.gz zsh-a168efe73e467c7164ef9b49dea61e9aefd27a48.tar.bz2 zsh-a168efe73e467c7164ef9b49dea61e9aefd27a48.zip | |
fix(poetry-env): activate only if env exists (#12301)
Diffstat (limited to 'plugins/poetry-env')
| -rw-r--r-- | plugins/poetry-env/poetry-env.plugin.zsh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/poetry-env/poetry-env.plugin.zsh b/plugins/poetry-env/poetry-env.plugin.zsh index 86e5fad4e..97ca52492 100644 --- a/plugins/poetry-env/poetry-env.plugin.zsh +++ b/plugins/poetry-env/poetry-env.plugin.zsh @@ -14,10 +14,10 @@ _togglePoetryShell() { # activate the environment if pyproject.toml exists if [[ "$poetry_active" != 1 ]]; then if [[ -f "$PWD/pyproject.toml" ]]; then - if grep -q 'tool.poetry' "$PWD/pyproject.toml"; then + if grep -q 'tool.poetry' "$PWD/pyproject.toml" && venv_dir=$(poetry env info --path); then export poetry_active=1 export poetry_dir="$PWD" - source "$(poetry env info --path)/bin/activate" + source "${venv_dir}/bin/activate" fi fi fi |
