cmd: 'del' should set %errorlevel% to zero, not one, on error.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
66fc13197b
commit
16cb9c4cb7
|
@ -1410,10 +1410,8 @@ BOOL WCMD_delete (WCHAR *args) {
|
||||||
|
|
||||||
argsProcessed = TRUE;
|
argsProcessed = TRUE;
|
||||||
found = WCMD_delete_one(thisArg);
|
found = WCMD_delete_one(thisArg);
|
||||||
if (!found) {
|
if (!found)
|
||||||
errorlevel = 1;
|
|
||||||
WCMD_output_stderr(WCMD_LoadMessage(WCMD_FILENOTFOUND), thisArg);
|
WCMD_output_stderr(WCMD_LoadMessage(WCMD_FILENOTFOUND), thisArg);
|
||||||
}
|
|
||||||
foundAny |= found;
|
foundAny |= found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1493,6 +1493,28 @@ for /f "tokens=3,2,3*" %%i in ("a b c d e f g") do echo h=%%h i=%%i j=%%j k=%%k
|
||||||
cd ..
|
cd ..
|
||||||
rd /s/q foobar
|
rd /s/q foobar
|
||||||
|
|
||||||
|
echo ------------ Testing del ------------
|
||||||
|
echo abc > file
|
||||||
|
echo deleting 'file'
|
||||||
|
del file
|
||||||
|
if errorlevel 0 (
|
||||||
|
echo errorlevel is 0, good
|
||||||
|
) else (
|
||||||
|
echo unexpected errorlevel, got %errorlevel%
|
||||||
|
)
|
||||||
|
if not exist file (
|
||||||
|
echo successfully deleted 'file'
|
||||||
|
) else (
|
||||||
|
echo error deleting 'file'
|
||||||
|
)
|
||||||
|
echo attempting to delete 'file', even though it is not present
|
||||||
|
del file
|
||||||
|
if errorlevel 0 (
|
||||||
|
echo errorlevel is 0, good
|
||||||
|
) else (
|
||||||
|
echo unexpected errorlevel, got %errorlevel%
|
||||||
|
)
|
||||||
|
|
||||||
echo ------------ Testing del /a ------------
|
echo ------------ Testing del /a ------------
|
||||||
del /f/q *.test > nul
|
del /f/q *.test > nul
|
||||||
echo r > r.test
|
echo r > r.test
|
||||||
|
|
|
@ -1009,6 +1009,12 @@ h=%h i=a j=b k=c l=d e f g m=%m n=%n o=%o@or_broken@h=%h i=a j=b k=c l=d e f g m
|
||||||
h=%h i=a j=c k= l= m=%m n=%n o=%o@or_broken@h=%h i=a j=c k= l= m= n=%n o=%o
|
h=%h i=a j=c k= l= m=%m n=%n o=%o@or_broken@h=%h i=a j=c k= l= m= n=%n o=%o
|
||||||
h=%h i=b j=c k= l= m=%m n=%n o=%o@or_broken@h=%h i=b j=c k= l= m= n=%n o=%o
|
h=%h i=b j=c k= l= m=%m n=%n o=%o@or_broken@h=%h i=b j=c k= l= m= n=%n o=%o
|
||||||
h=%h i=b j=c k= l= m=%m n=%n o=%o@or_broken@h=%h i=b j=c k= l= m= n=%n o=%o
|
h=%h i=b j=c k= l= m=%m n=%n o=%o@or_broken@h=%h i=b j=c k= l= m= n=%n o=%o
|
||||||
|
------------ Testing del ------------
|
||||||
|
deleting 'file'
|
||||||
|
errorlevel is 0, good
|
||||||
|
successfully deleted 'file'
|
||||||
|
attempting to delete 'file', even though it is not present
|
||||||
|
errorlevel is 0, good
|
||||||
------------ Testing del /a ------------
|
------------ Testing del /a ------------
|
||||||
not-r.test not found after delete, good
|
not-r.test not found after delete, good
|
||||||
r.test found before delete, good
|
r.test found before delete, good
|
||||||
|
|
Loading…
Reference in New Issue