From 8c79559748b9828d2ad6a5bff89db4da0283d6b2 Mon Sep 17 00:00:00 2001 From: xEgoist Date: Tue, 18 Apr 2023 19:59:33 -0500 Subject: [PATCH] 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`. --- lib/std/os/windows.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 8d2df4c7ef..7a2d75f345 100644 --- a/lib/std/os/windows.zig +++ b/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{