Skip to content

Commit

Permalink
Fix a bug of deleting a virtualenv that is not managed by Pipenv
Browse files Browse the repository at this point in the history
Close #4867
  • Loading branch information
frostming committed Nov 16, 2021
1 parent b0ceaed commit eafcfb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/4867.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug of deleting a virtualenv that is not managed by Pipenv.
3 changes: 2 additions & 1 deletion pipenv/cli/command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys

from pipenv import environments
from pipenv.__version__ import __version__
from pipenv._compat import fix_utf8
from pipenv.cli.options import (
Expand Down Expand Up @@ -124,7 +125,7 @@ def cli(
# --rm was passed...
elif rm:
# Abort if --system (or running in a virtualenv).
if state.project.s.PIPENV_USE_SYSTEM:
if state.project.s.PIPENV_USE_SYSTEM or environments.is_in_virtualenv():
echo(
crayons.red(
"You are attempting to remove a virtualenv that "
Expand Down

0 comments on commit eafcfb2

Please sign in to comment.