Commit 16cb9c4c authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

cmd: 'del' should set %errorlevel% to zero, not one, on error.

parent 66fc1319
......@@ -1410,10 +1410,8 @@ BOOL WCMD_delete (WCHAR *args) {
argsProcessed = TRUE;
found = WCMD_delete_one(thisArg);
if (!found) {
errorlevel = 1;
if (!found)
WCMD_output_stderr(WCMD_LoadMessage(WCMD_FILENOTFOUND), thisArg);
}
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 ..
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 ------------
del /f/q *.test > nul
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=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 ------------
not-r.test not found after delete, good
r.test found before delete, good
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment