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@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; } }
Florian Eder others.meder@gmail.com wrote:
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; }
}
Probably it would look more naturally with else if (!interactive) errorlevel = 0; instead of abruptly doing a return.