From cf1a3b27639ec7b570c32e1640328de3188fe415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szramowski?= Date: Wed, 7 Sep 2022 00:11:38 +0200 Subject: [PATCH] Do not disable echo for subsequent commands in batch activators (#2411) --- src/virtualenv/activation/batch/activate.bat | 46 +++++++++---------- .../activation/batch/deactivate.bat | 24 +++++----- 2 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/virtualenv/activation/batch/activate.bat b/src/virtualenv/activation/batch/activate.bat index bf774b282..816853c6b 100644 --- a/src/virtualenv/activation/batch/activate.bat +++ b/src/virtualenv/activation/batch/activate.bat @@ -1,39 +1,37 @@ -@echo off +@set "VIRTUAL_ENV=__VIRTUAL_ENV__" -set "VIRTUAL_ENV=__VIRTUAL_ENV__" - -if defined _OLD_VIRTUAL_PROMPT ( - set "PROMPT=%_OLD_VIRTUAL_PROMPT%" +@if defined _OLD_VIRTUAL_PROMPT ( + @set "PROMPT=%_OLD_VIRTUAL_PROMPT%" ) else ( - if not defined PROMPT ( - set "PROMPT=$P$G" + @if not defined PROMPT ( + @set "PROMPT=$P$G" ) - if not defined VIRTUAL_ENV_DISABLE_PROMPT ( - set "_OLD_VIRTUAL_PROMPT=%PROMPT%" + @if not defined VIRTUAL_ENV_DISABLE_PROMPT ( + @set "_OLD_VIRTUAL_PROMPT=%PROMPT%" ) ) -if not defined VIRTUAL_ENV_DISABLE_PROMPT ( - if "__VIRTUAL_PROMPT__" NEQ "" ( - set "PROMPT=(__VIRTUAL_PROMPT__) %PROMPT%" +@if not defined VIRTUAL_ENV_DISABLE_PROMPT ( + @if "__VIRTUAL_PROMPT__" NEQ "" ( + @set "PROMPT=(__VIRTUAL_PROMPT__) %PROMPT%" ) else ( - for %%d in ("%VIRTUAL_ENV%") do set "PROMPT=(%%~nxd) %PROMPT%" + @for %%d in ("%VIRTUAL_ENV%") do @set "PROMPT=(%%~nxd) %PROMPT%" ) ) -REM Don't use () to avoid problems with them in %PATH% -if defined _OLD_VIRTUAL_PYTHONHOME goto ENDIFVHOME - set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%" +@REM Don't use () to avoid problems with them in %PATH% +@if defined _OLD_VIRTUAL_PYTHONHOME @goto ENDIFVHOME + @set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%" :ENDIFVHOME -set PYTHONHOME= +@set PYTHONHOME= -REM if defined _OLD_VIRTUAL_PATH ( -if not defined _OLD_VIRTUAL_PATH goto ENDIFVPATH1 - set "PATH=%_OLD_VIRTUAL_PATH%" +@REM if defined _OLD_VIRTUAL_PATH ( +@if not defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH1 + @set "PATH=%_OLD_VIRTUAL_PATH%" :ENDIFVPATH1 -REM ) else ( -if defined _OLD_VIRTUAL_PATH goto ENDIFVPATH2 - set "_OLD_VIRTUAL_PATH=%PATH%" +@REM ) else ( +@if defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH2 + @set "_OLD_VIRTUAL_PATH=%PATH%" :ENDIFVPATH2 -set "PATH=%VIRTUAL_ENV%\__BIN_NAME__;%PATH%" +@set "PATH=%VIRTUAL_ENV%\__BIN_NAME__;%PATH%" diff --git a/src/virtualenv/activation/batch/deactivate.bat b/src/virtualenv/activation/batch/deactivate.bat index 7bbc56882..f800f42c1 100644 --- a/src/virtualenv/activation/batch/deactivate.bat +++ b/src/virtualenv/activation/batch/deactivate.bat @@ -1,19 +1,17 @@ -@echo off +@set VIRTUAL_ENV= -set VIRTUAL_ENV= - -REM Don't use () to avoid problems with them in %PATH% -if not defined _OLD_VIRTUAL_PROMPT goto ENDIFVPROMPT - set "PROMPT=%_OLD_VIRTUAL_PROMPT%" - set _OLD_VIRTUAL_PROMPT= +@REM Don't use () to avoid problems with them in %PATH% +@if not defined _OLD_VIRTUAL_PROMPT @goto ENDIFVPROMPT + @set "PROMPT=%_OLD_VIRTUAL_PROMPT%" + @set _OLD_VIRTUAL_PROMPT= :ENDIFVPROMPT -if not defined _OLD_VIRTUAL_PYTHONHOME goto ENDIFVHOME - set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%" - set _OLD_VIRTUAL_PYTHONHOME= +@if not defined _OLD_VIRTUAL_PYTHONHOME @goto ENDIFVHOME + @set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%" + @set _OLD_VIRTUAL_PYTHONHOME= :ENDIFVHOME -if not defined _OLD_VIRTUAL_PATH goto ENDIFVPATH - set "PATH=%_OLD_VIRTUAL_PATH%" - set _OLD_VIRTUAL_PATH= +@if not defined _OLD_VIRTUAL_PATH @goto ENDIFVPATH + @set "PATH=%_OLD_VIRTUAL_PATH%" + @set _OLD_VIRTUAL_PATH= :ENDIFVPATH