diff --git a/std/io/test.zig b/std/io/test.zig index 4b25d645fc4302430eb49e6aa602363edfeaba1e..40258eab5f2e67c9a1411e1a754f29bd95067fe7 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 d10ab695dbe6b361fcfede171bbd825a97392fb9..ad5263dc0b6b5e4ae3f1171e666ed71e53506f5b 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), } }