diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-12-05 19:08:37 -0800 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-12-23 22:15:07 -0800 |
| commit | aafddc2ea13e40a8262d9378aeca2e097a37ac03 (patch) | |
| tree | 46770e51147a635a43c2e7356e62064466b51c34 /lib/std/Build/Step | |
| parent | eab354b2f5d7242c036523394023e9824be7eca9 (diff) | |
| download | zig-aafddc2ea13e40a8262d9378aeca2e097a37ac03.tar.gz zig-aafddc2ea13e40a8262d9378aeca2e097a37ac03.zip | |
update all occurrences of close() to close(io)
Diffstat (limited to 'lib/std/Build/Step')
| -rw-r--r-- | lib/std/Build/Step/InstallArtifact.zig | 3 | ||||
| -rw-r--r-- | lib/std/Build/Step/InstallDir.zig | 2 | ||||
| -rw-r--r-- | lib/std/Build/Step/Run.zig | 20 | ||||
| -rw-r--r-- | lib/std/Build/Step/WriteFile.zig | 10 |
4 files changed, 20 insertions, 15 deletions
diff --git a/lib/std/Build/Step/InstallArtifact.zig b/lib/std/Build/Step/InstallArtifact.zig index c203ae924b..1cdb232770 100644 --- a/lib/std/Build/Step/InstallArtifact.zig +++ b/lib/std/Build/Step/InstallArtifact.zig @@ -119,6 +119,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { _ = options; const install_artifact: *InstallArtifact = @fieldParentPtr("step", step); const b = step.owner; + const io = b.graph.io; var all_cached = true; @@ -168,7 +169,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { src_dir_path, @errorName(err), }); }; - defer src_dir.close(); + defer src_dir.close(io); var it = try src_dir.walk(b.allocator); next_entry: while (try it.next()) |entry| { diff --git a/lib/std/Build/Step/InstallDir.zig b/lib/std/Build/Step/InstallDir.zig index ecb0959cc7..788d5565a7 100644 --- a/lib/std/Build/Step/InstallDir.zig +++ b/lib/std/Build/Step/InstallDir.zig @@ -68,7 +68,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { var src_dir = src_dir_path.root_dir.handle.openDir(io, src_dir_path.subPathOrDot(), .{ .iterate = true }) catch |err| { return step.fail("unable to open source directory '{f}': {t}", .{ src_dir_path, err }); }; - defer src_dir.close(); + defer src_dir.close(io); var it = try src_dir.walk(arena); var all_cached = true; next_entry: while (try it.next()) |entry| { diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig index 28c09e1faf..e66e30cc79 100644 --- a/lib/std/Build/Step/Run.zig +++ b/lib/std/Build/Step/Run.zig @@ -851,7 +851,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { .{ file_path, err }, ); }; - defer file.close(); + defer file.close(io); var buf: [1024]u8 = undefined; var file_reader = file.reader(io, &buf); @@ -1111,7 +1111,7 @@ pub fn rerunInFuzzMode( result.writer.writeAll(file_plp.prefix) catch return error.OutOfMemory; const file = try file_path.root_dir.handle.openFile(file_path.subPathOrDot(), .{}); - defer file.close(); + defer file.close(io); var buf: [1024]u8 = undefined; var file_reader = file.reader(io, &buf); @@ -1671,8 +1671,10 @@ fn evalZigTest( options: Step.MakeOptions, fuzz_context: ?FuzzContext, ) !EvalZigTestResult { - const gpa = run.step.owner.allocator; - const arena = run.step.owner.allocator; + const step_owner = run.step.owner; + const gpa = step_owner.allocator; + const arena = step_owner.allocator; + const io = step_owner.graph.io; // We will update this every time a child runs. run.step.result_peak_rss = 0; @@ -1724,7 +1726,7 @@ fn evalZigTest( run.step.result_stderr = try arena.dupe(u8, poller.reader(.stderr).buffered()); // Clean up everything and wait for the child to exit. - child.stdin.?.close(); + child.stdin.?.close(io); child.stdin = null; poller.deinit(); child_killed = true; @@ -1744,7 +1746,7 @@ fn evalZigTest( poller.reader(.stderr).tossBuffered(); // Clean up everything and wait for the child to exit. - child.stdin.?.close(); + child.stdin.?.close(io); child.stdin = null; poller.deinit(); child_killed = true; @@ -2177,7 +2179,7 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { child.stdin.?.writeAll(bytes) catch |err| { return run.step.fail("unable to write stdin: {s}", .{@errorName(err)}); }; - child.stdin.?.close(); + child.stdin.?.close(io); child.stdin = null; }, .lazy_path => |lazy_path| { @@ -2185,7 +2187,7 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { const file = path.root_dir.handle.openFile(path.subPathOrDot(), .{}) catch |err| { return run.step.fail("unable to open stdin file: {s}", .{@errorName(err)}); }; - defer file.close(); + defer file.close(io); // TODO https://github.com/ziglang/zig/issues/23955 var read_buffer: [1024]u8 = undefined; var file_reader = file.reader(io, &read_buffer); @@ -2204,7 +2206,7 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult { stdin_writer.err.?, }), }; - child.stdin.?.close(); + child.stdin.?.close(io); child.stdin = null; }, .none => {}, diff --git a/lib/std/Build/Step/WriteFile.zig b/lib/std/Build/Step/WriteFile.zig index 030c7c6811..201b132271 100644 --- a/lib/std/Build/Step/WriteFile.zig +++ b/lib/std/Build/Step/WriteFile.zig @@ -206,7 +206,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { } } - const open_dir_cache = try arena.alloc(fs.Dir, write_file.directories.items.len); + const open_dir_cache = try arena.alloc(Io.Dir, write_file.directories.items.len); var open_dirs_count: usize = 0; defer closeDirs(open_dir_cache[0..open_dirs_count]); @@ -264,7 +264,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void { b.cache_root, cache_path, @errorName(err), }); }; - defer cache_dir.close(); + defer cache_dir.close(io); for (write_file.files.items) |file| { if (fs.path.dirname(file.sub_path)) |dirname| { @@ -342,6 +342,8 @@ fn make(step: *Step, options: Step.MakeOptions) !void { try step.writeManifest(&man); } -fn closeDirs(dirs: []fs.Dir) void { - for (dirs) |*d| d.close(); +fn closeDirs(io: Io, dirs: []Io.Dir) void { + var group: Io.Group = .init; + defer group.wait(); + for (dirs) |d| group.async(Io.Dir.close, .{ d, io }); } |
