Skip to content

Commit 8c79559

Browse files
committed
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 commit 8c79559

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/std/os/windows.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil
934934
.NOT_A_DIRECTORY => return error.NotDir,
935935
.SHARING_VIOLATION => return error.FileBusy,
936936
.ACCESS_DENIED => return error.AccessDenied,
937+
.DELETE_PENDING => return,
937938
else => return unexpectedStatus(rc),
938939
}
939940
var file_dispo = FILE_DISPOSITION_INFORMATION{

0 commit comments

Comments
 (0)