authorgravatar for egoist@egoistic.devxEgoist <egoist@egoistic.dev> 2023-04-18 19:59:33-05:00
committergravatar for egoist@egoistic.devxEgoist <egoist@egoistic.dev> 2023-04-18 19:59:33-05:00
log8c79559748b9828d2ad6a5bff89db4da0283d6b2
treec5b835f843f6c4ebd003d52ab2abbe7a241ae4c0
parent55b2456c1187b22b2b8e2d3643aff86815dae551

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 files changed, 1 insertions(+), 0 deletions(-)

lib/std/os/windows.zig+1
...@@ -934,6 +934,7 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil...@@ -934,6 +934,7 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil
934 .NOT_A_DIRECTORY => return error.NotDir,934 .NOT_A_DIRECTORY => return error.NotDir,
935 .SHARING_VIOLATION => return error.FileBusy,935 .SHARING_VIOLATION => return error.FileBusy,
936 .ACCESS_DENIED => return error.AccessDenied,936 .ACCESS_DENIED => return error.AccessDenied,
937 .DELETE_PENDING => return,
937 else => return unexpectedStatus(rc),938 else => return unexpectedStatus(rc),
938 }939 }
939 var file_dispo = FILE_DISPOSITION_INFORMATION{940 var file_dispo = FILE_DISPOSITION_INFORMATION{