authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-10-11 12:17:13-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-10-11 12:17:39-04:00
log95242cc43132c7b6aeb2f7171389075859aba008
tree90794f4ef48e76764daf484ff3cc4def70902a76
parent8efcfeaf1e6db6e26d31132bbd2eb3317d9749bf

windows: workaround kernel race condition even more


2 files changed, 4 insertions(+), 4 deletions(-)

src/link.zig+2-2
......@@ -616,13 +616,13 @@ pub const File = struct {
616616 &coff.mf
617617 else
618618 unreachable;
619 mf.file = for (0..2) |_| break base.emit.root_dir.handle.openFile(base.emit.sub_path, .{
619 mf.file = for (0..10) |_| break base.emit.root_dir.handle.openFile(base.emit.sub_path, .{
620620 .mode = .read_write,
621621 }) catch |err| switch (err) {
622622 error.AccessDenied => switch (builtin.os.tag) {
623623 .windows => {
624624 // give the kernel a chance to finish closing the executable handle
625 std.os.windows.kernel32.Sleep(1);
625 std.os.windows.kernel32.Sleep(10);
626626 continue;
627627 },
628628 else => return error.AccessDenied,
test/standalone/windows_spawn/main.zig+2-2
......@@ -71,10 +71,10 @@ pub fn main() anyerror!void {
7171 try testExec(allocator, "heLLo", "hello from exe\n");
7272
7373 // now rename the exe to not have an extension
74 for (0..2) |_| break tmp.dir.rename("hello.exe", "hello") catch |err| switch (err) {
74 for (0..10) |_| break tmp.dir.rename("hello.exe", "hello") catch |err| switch (err) {
7575 error.AccessDenied => {
7676 // give the kernel a chance to finish closing the executable handle
77 std.os.windows.kernel32.Sleep(1);
77 std.os.windows.kernel32.Sleep(10);
7878 continue;
7979 },
8080 else => |e| return e,