mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 05:48:31 +00:00
windows: workaround kernel race condition even more
This commit is contained in:
parent
8efcfeaf1e
commit
95242cc431
@ -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,
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user