From 67bc43902cdf37f466b468e23823306dc5bf2cc2 Mon Sep 17 00:00:00 2001 From: Samuel Carswell Date: Fri, 8 Mar 2024 15:54:55 +1100 Subject: [PATCH 1/2] Use fancy mode for pwsh on *nix --- pipenv/cli/command.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 57fe0604..09b6437b 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -388,8 +388,12 @@ def shell(state, fancy=False, shell_args=None, anyway=False, quiet=False): sys.exit(1) # Load .env file. load_dot_env(state.project) - # Use fancy mode for Windows. - if os.name == "nt": + # Use fancy mode for Windows or pwsh on *nix. + if ( + os.name == "nt" + or os.environ["PIPENV_SHELL"].split(os.path.sep)[-1] == "pwsh" + or os.environ["SHELL"].split(os.path.sep)[-1] == "pwsh" + ): fancy = True do_shell( state.project, From cecc7d02f26ae68925b5de038b6e02566a1ea182 Mon Sep 17 00:00:00 2001 From: Samuel Carswell Date: Fri, 22 Mar 2024 11:26:51 +1100 Subject: [PATCH 2/2] Correctly getting env vars in pipenv.cli.command.shell --- pipenv/cli/command.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 09b6437b..04a89626 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -391,8 +391,8 @@ def shell(state, fancy=False, shell_args=None, anyway=False, quiet=False): # Use fancy mode for Windows or pwsh on *nix. if ( os.name == "nt" - or os.environ["PIPENV_SHELL"].split(os.path.sep)[-1] == "pwsh" - or os.environ["SHELL"].split(os.path.sep)[-1] == "pwsh" + or (os.environ.get("PIPENV_SHELL") or "").split(os.path.sep)[-1] == "pwsh" + or (os.environ.get("SHELL") or "").split(os.path.sep)[-1] == "pwsh" ): fancy = True do_shell(