pub fn captureStdOut(run: *Run, options: CapturedStdIo.Options) std.Build.LazyPath run: *Runoptions: CapturedStdIo.Options773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792pub fn captureStdOut(run: *Run, options: CapturedStdIo.Options) std.Build.LazyPath {
assert(run.stdio != .inherit);
assert(run.stdio != .zig_test);
const b = run.step.owner;
const graph = b.graph;
const arena = graph.arena;
if (run.captured_stdout) |captured| return .{ .generated = .{ .index = captured.generated_file } };
const captured = arena.create(CapturedStdIo) catch @panic("OOM");
captured.* = .{
.prefix = "",
.basename = if (options.basename) |basename| graph.dupeString(basename) else "stdout",
.generated_file = graph.addGeneratedFile(&run.step),
.trim_whitespace = options.trim_whitespace,
};
run.captured_stdout = captured;
return .{ .generated = .{ .index = captured.generated_file } };
}