Skip to content

Commit dbb5686

Browse files
committed
Fixes python#29308: Merged fix from 3.5.
2 parents ae28ffd + 3ac5042 commit dbb5686

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Lib/venv/scripts/nt/Activate.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ deactivate -nondestructive
2929

3030
$env:VIRTUAL_ENV="__VENV_DIR__"
3131

32-
# Set the prompt to include the env name
33-
# Make sure _OLD_VIRTUAL_PROMPT is global
34-
function global:_OLD_VIRTUAL_PROMPT {""}
35-
copy-item function:prompt function:_OLD_VIRTUAL_PROMPT
36-
function global:prompt {
37-
Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__'
38-
_OLD_VIRTUAL_PROMPT
32+
if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) {
33+
# Set the prompt to include the env name
34+
# Make sure _OLD_VIRTUAL_PROMPT is global
35+
function global:_OLD_VIRTUAL_PROMPT {""}
36+
copy-item function:prompt function:_OLD_VIRTUAL_PROMPT
37+
function global:prompt {
38+
Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__'
39+
_OLD_VIRTUAL_PROMPT
40+
}
3941
}
4042

4143
# Clear PYTHONHOME

0 commit comments

Comments
 (0)