authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-16 19:28:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-06-16 19:28:13-07:00
log42658de76287ecd24691d774232c5ec07107a0ee
treee0189cd022c8f5da1330aa0d6bbc8d7ac7ae24b1
parent20e20f9238b1f4537a8186d80afbdf7516e127f6

std.process.Child: `run` fn accepts std.Progress.Node

There was not a way to pass a progress node to this function until now.

1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/process/Child.zig+3-1
...@@ -101,7 +101,7 @@ resource_usage_statistics: ResourceUsageStatistics = .{},...@@ -101,7 +101,7 @@ resource_usage_statistics: ResourceUsageStatistics = .{},
101///101///
102/// The child's progress tree will be grafted into the parent's progress tree,102/// The child's progress tree will be grafted into the parent's progress tree,
103/// by substituting this node with the child's root node.103/// by substituting this node with the child's root node.
104progress_node: std.Progress.Node = .{ .index = .none },104progress_node: std.Progress.Node = std.Progress.Node.none,
105105
106pub const ResourceUsageStatistics = struct {106pub const ResourceUsageStatistics = struct {
107 rusage: @TypeOf(rusage_init) = rusage_init,107 rusage: @TypeOf(rusage_init) = rusage_init,
...@@ -376,6 +376,7 @@ pub fn run(args: struct {...@@ -376,6 +376,7 @@ pub fn run(args: struct {
376 env_map: ?*const EnvMap = null,376 env_map: ?*const EnvMap = null,
377 max_output_bytes: usize = 50 * 1024,377 max_output_bytes: usize = 50 * 1024,
378 expand_arg0: Arg0Expand = .no_expand,378 expand_arg0: Arg0Expand = .no_expand,
379 progress_node: std.Progress.Node = std.Progress.Node.none,
379}) RunError!RunResult {380}) RunError!RunResult {
380 var child = ChildProcess.init(args.argv, args.allocator);381 var child = ChildProcess.init(args.argv, args.allocator);
381 child.stdin_behavior = .Ignore;382 child.stdin_behavior = .Ignore;
...@@ -385,6 +386,7 @@ pub fn run(args: struct {...@@ -385,6 +386,7 @@ pub fn run(args: struct {
385 child.cwd_dir = args.cwd_dir;386 child.cwd_dir = args.cwd_dir;
386 child.env_map = args.env_map;387 child.env_map = args.env_map;
387 child.expand_arg0 = args.expand_arg0;388 child.expand_arg0 = args.expand_arg0;
389 child.progress_node = args.progress_node;
388390
389 var stdout = std.ArrayList(u8).init(args.allocator);391 var stdout = std.ArrayList(u8).init(args.allocator);
390 var stderr = std.ArrayList(u8).init(args.allocator);392 var stderr = std.ArrayList(u8).init(args.allocator);