diff --git a/std/io/test.zig b/std/io/test.zig index 4b25d645fc..40258eab5f 100644 --- a/std/io/test.zig +++ b/std/io/test.zig @@ -597,7 +597,10 @@ test "c out stream" { const filename = c"tmp_io_test_file.txt"; const out_file = std.c.fopen(filename, c"w") orelse return error.UnableToOpenTestFile; - defer fs.deleteFileC(filename) catch {}; + defer { + _ = std.c.fclose(out_file); + fs.deleteFileC(filename) catch {}; + } const out_stream = &io.COutStream.init(out_file).stream; try out_stream.print("hi: {}\n", i32(123)); diff --git a/std/os/windows.zig b/std/os/windows.zig index d10ab695db..ad5263dc0b 100644 --- a/std/os/windows.zig +++ b/std/os/windows.zig @@ -348,6 +348,7 @@ pub const DeleteFileError = error{ FileNotFound, AccessDenied, NameTooLong, + FileBusy, Unexpected, }; @@ -363,6 +364,7 @@ pub fn DeleteFileW(filename: [*]const u16) DeleteFileError!void { ERROR.ACCESS_DENIED => return error.AccessDenied, ERROR.FILENAME_EXCED_RANGE => return error.NameTooLong, ERROR.INVALID_PARAMETER => return error.NameTooLong, + ERROR.SHARING_VIOLATION => return error.FileBusy, else => |err| return unexpectedError(err), } }