diff --git a/src/link.zig b/src/link.zig index 6863420d63fee102120a1fd4ee2b019c1933e041..0a63ee08437ca0169207242dabf903b545ffbc13 100644 --- a/src/link.zig +++ b/src/link.zig @@ -616,13 +616,13 @@ pub const File = struct { &coff.mf else unreachable; - mf.file = for (0..2) |_| break base.emit.root_dir.handle.openFile(base.emit.sub_path, .{ + mf.file = for (0..10) |_| break base.emit.root_dir.handle.openFile(base.emit.sub_path, .{ .mode = .read_write, }) catch |err| switch (err) { error.AccessDenied => switch (builtin.os.tag) { .windows => { // give the kernel a chance to finish closing the executable handle - std.os.windows.kernel32.Sleep(1); + std.os.windows.kernel32.Sleep(10); continue; }, else => return error.AccessDenied, diff --git a/test/standalone/windows_spawn/main.zig b/test/standalone/windows_spawn/main.zig index 2b1a9c0c362488b31e0662cea2824caac2999ce8..d8e259932e4586f933da75fa3a963ce00b863ab6 100644 --- a/test/standalone/windows_spawn/main.zig +++ b/test/standalone/windows_spawn/main.zig @@ -71,10 +71,10 @@ pub fn main() anyerror!void { try testExec(allocator, "heLLo", "hello from exe\n"); // now rename the exe to not have an extension - for (0..2) |_| break tmp.dir.rename("hello.exe", "hello") catch |err| switch (err) { + for (0..10) |_| break tmp.dir.rename("hello.exe", "hello") catch |err| switch (err) { error.AccessDenied => { // give the kernel a chance to finish closing the executable handle - std.os.windows.kernel32.Sleep(1); + std.os.windows.kernel32.Sleep(10); continue; }, else => |e| return e,