# Fix Shell Activation For ZSH
This PR resolves an issue wherein poetry will clear the `PATH` on zsh.
The activation script contains a number of if statements of the
following form:
```bash
# ...
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
```
These constructs are valid in bash, although zsh fails to negate the
conditional except when placed in emulation mode:
```zsh
# Causes PATH to be cleared, leading to other issues
. /home/alecto/.cache/pypoetry/virtualenvs/poetry-E-aAiPjf-py3.10/bin/activate
```
When bash is used as an emulator to source the script, it functions
correctly:
```zsh
# Functions correctly
emulate bash -c '. /home/alecto/.cache/pypoetry/virtualenvs/poetry-E-aAiPjf-py3.10/bin/activate'
```
It's important to note that this doesn't place the *entire* shell into
bash emulation mode; only the activate script is sourced as bash.
Any guidance on what tests should be added for this PR would be
appreciated.
Co-authored-by: Alecto Irene Perez <alecto.perez@voladynamics.com>
Co-authored-by: Bartosz Sokorski <b.sokorski@gmail.com>
| Name |
Last commit
|
Last Update |
|---|---|---|
| .github | Loading commit data... | |
| assets | Loading commit data... | |
| docs | Loading commit data... | |
| src/poetry | Loading commit data... | |
| tests | Loading commit data... | |
| .cirrus.yml | Loading commit data... | |
| .flake8 | Loading commit data... | |
| .gitignore | Loading commit data... | |
| .pre-commit-config.yaml | Loading commit data... | |
| .pre-commit-hooks.yaml | Loading commit data... | |
| CHANGELOG.md | Loading commit data... | |
| CODE_OF_CONDUCT.md | Loading commit data... | |
| CONTRIBUTING.md | Loading commit data... | |
| LICENSE | Loading commit data... | |
| README.md | Loading commit data... | |
| get-poetry.py | Loading commit data... | |
| install-poetry.py | Loading commit data... | |
| poetry.lock | Loading commit data... | |
| pyproject.toml | Loading commit data... |