Skip to content

Commit d2a6e99

Browse files
committed
Add check for activated virtual environment before clearing packages
This is necessary since 'pip list' ignores the '--require-virtualenv' flag
1 parent 990e456 commit d2a6e99

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/venv-cli/venv.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ venv::clear() {
347347
return "${_success}"
348348
fi
349349

350+
if ! venv::_check_venv_activated; then
351+
return "${_fail}"
352+
fi
353+
350354
venv::color_echo "${_yellow}" "Removing all packages from virtual environment ..."
351355
pip freeze --require-virtualenv \
352356
| cut -d "@" -f1 \

0 commit comments

Comments
 (0)