Commit 8c79559748

xEgoist <egoist@egoistic.dev>
2023-04-19 02:59:33
windows: Handle `DELETE_PENDING` in `DeleteFile`.
DELETE_PENDING can happen when the file is yet to be closed for deletion or if it never get closed. In that case, DeleteFile should assume the file deletion is succeeding (no CloseHandle is required as it's a "failure"). In case of `DELETE_PENDING` failure, the file may still exist. In which case if it's part of `deleteTree`, it will eventually fail on `error.DirNotEmpty`.
1 parent 55b2456
Changed files (1)
lib
lib/std/os/windows.zig
@@ -934,6 +934,7 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil
         .NOT_A_DIRECTORY => return error.NotDir,
         .SHARING_VIOLATION => return error.FileBusy,
         .ACCESS_DENIED => return error.AccessDenied,
+        .DELETE_PENDING => return,
         else => return unexpectedStatus(rc),
     }
     var file_dispo = FILE_DISPOSITION_INFORMATION{