Skip to content

Commit 95242cc

Browse files
committed
windows: workaround kernel race condition even more
1 parent 8efcfea commit 95242cc

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/link.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

0 commit comments

Comments
 (0)