From 3d2188b930105761d4ea833ec2634810708a9557 Mon Sep 17 00:00:00 2001 From: Josh Stern Date: Mon, 29 Jul 2024 17:36:09 -0400 Subject: [PATCH] Check end of path for shell detection Addresses issue: #6197 Previously these branches would trip if the shell name was present anywhere in the cmd path. This updates the check to only look at the end. --- news/6197.bugfix.rst | 1 + pipenv/shells.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 news/6197.bugfix.rst diff --git a/news/6197.bugfix.rst b/news/6197.bugfix.rst new file mode 100644 index 0000000000..bf28c7e0a1 --- /dev/null +++ b/news/6197.bugfix.rst @@ -0,0 +1 @@ +Update shell detection to only check the end of the command used. diff --git a/pipenv/shells.py b/pipenv/shells.py index 89467cddb8..00e8358ad9 100644 --- a/pipenv/shells.py +++ b/pipenv/shells.py @@ -37,17 +37,17 @@ def _get_activate_script(cmd, venv): """ # Suffix and source command for other shells. # Support for fish shell. - if "fish" in cmd: + if cmd.endswith("fish"): suffix = ".fish" command = "source" # Support for csh shell. - elif "csh" in cmd: + elif cmd.endswith("csh"): suffix = ".csh" command = "source" - elif "xonsh" in cmd: + elif cmd.endswith("xonsh"): suffix = ".xsh" command = "source" - elif "nu" in cmd: + elif cmd.endswith("nu"): suffix = ".nu" command = "overlay use" else: