| ... | ... | @@ -269,7 +269,17 @@ const Allocator = std.mem.Allocator; |
| 269 | 269 | const assert = std.debug.assert; |
| 270 | 270 | const builtin = @import("builtin"); |
| 271 | 271 | |
| 272 | | pub fn evalChildProcess(s: *Step, argv: []const []const u8) !void { |
| 272 | pub fn evalChildProcess(s: *Step, argv: []const []const u8) ![]u8 { |
| 273 | const run_result = try captureChildProcess(s, std.Progress.Node.none, argv); |
| 274 | try handleChildProcessTerm(s, run_result.term, null, argv); |
| 275 | return run_result.stdout; |
| 276 | } |
| 277 | |
| 278 | pub fn captureChildProcess( |
| 279 | s: *Step, |
| 280 | progress_node: std.Progress.Node, |
| 281 | argv: []const []const u8, |
| 282 | ) !std.process.Child.RunResult { |
| 273 | 283 | const arena = s.owner.allocator; |
| 274 | 284 | |
| 275 | 285 | try handleChildProcUnsupported(s, null, argv); |
| ... | ... | @@ -278,13 +288,14 @@ pub fn evalChildProcess(s: *Step, argv: []const []const u8) !void { |
| 278 | 288 | const result = std.process.Child.run(.{ |
| 279 | 289 | .allocator = arena, |
| 280 | 290 | .argv = argv, |
| 291 | .progress_node = progress_node, |
| 281 | 292 | }) catch |err| return s.fail("unable to spawn {s}: {s}", .{ argv[0], @errorName(err) }); |
| 282 | 293 | |
| 283 | 294 | if (result.stderr.len > 0) { |
| 284 | 295 | try s.result_error_msgs.append(arena, result.stderr); |
| 285 | 296 | } |
| 286 | 297 | |
| 287 | | try handleChildProcessTerm(s, result.term, null, argv); |
| 298 | return result; |
| 288 | 299 | } |
| 289 | 300 | |
| 290 | 301 | pub fn fail(step: *Step, comptime fmt: []const u8, args: anytype) error{ OutOfMemory, MakeFailed } { |