From 3ac504289a93079f2f99d43b51c82153f7b3260a Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Fri, 27 Jan 2017 12:41:27 +0000 Subject: [PATCH] Fixes #29308: Respect VIRTUAL_ENV_DISABLE_PROMPT in Activate.ps1. --- Lib/venv/scripts/nt/Activate.ps1 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Lib/venv/scripts/nt/Activate.ps1 b/Lib/venv/scripts/nt/Activate.ps1 index b15decb9c58..c22b1ea1828 100644 --- a/Lib/venv/scripts/nt/Activate.ps1 +++ b/Lib/venv/scripts/nt/Activate.ps1 @@ -29,13 +29,15 @@ deactivate -nondestructive $env:VIRTUAL_ENV="__VENV_DIR__" -# Set the prompt to include the env name -# Make sure _OLD_VIRTUAL_PROMPT is global -function global:_OLD_VIRTUAL_PROMPT {""} -copy-item function:prompt function:_OLD_VIRTUAL_PROMPT -function global:prompt { - Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__' - _OLD_VIRTUAL_PROMPT +if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) { + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT {""} + copy-item function:prompt function:_OLD_VIRTUAL_PROMPT + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__' + _OLD_VIRTUAL_PROMPT + } } # Clear PYTHONHOME