[PATCH v2] cmd: Do not change errorlevel when setting environment variables

Florian Eder others.meder at gmail.com
Mon May 31 01:37:03 CDT 2021


Neither on Windows 7 nor 10 the errorlevel is changed in interactive /
non-Batch mode when setting / changing the value of an environment variable with SET.
This patch emulates this behavior, retaining the previous value.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47791
Signed-off-by: Florian Eder <others.meder at gmail.com>
---
v2: Errorlevel set to 0 in batch mode, remains untouched in interactive mode
This is identical to the behavior of the Windows CMD and should both not fail
the tests and resolve Bug 47791
---
 programs/cmd/builtins.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 502694ffc46..0e16ffda713 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -4218,6 +4218,7 @@ void WCMD_setshow_env (WCHAR *s) {
     if ((!status) & (gle == ERROR_ENVVAR_NOT_FOUND)) {
       errorlevel = 1;
     } else if (!status) WCMD_print_error();
+    else if (interactive) return;
     else errorlevel = 0;
   }
 }
-- 
2.31.1




More information about the wine-devel mailing list