Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

captureChildProcess

PkgConfig.captureChildProcess
fn captureChildProcess(maker: *Maker, step: *Step, arena: Allocator, options: Step.CaptureChildProcessOptions) ![]const u8

File

lib/compiler/Maker/PkgConfig.zig:112

Code

fn captureChildProcess(maker: *Maker, step: *Step, arena: Allocator, options: Step.CaptureChildProcessOptions) ![]const u8 {
    const captured = step.captureChildProcess(maker, arena, options) catch |err| switch (err) {
        error.FileNotFound => return error.PkgConfigUnavailable,
        else => |e| return e,
    };
    if (captured.stderr.len != 0) try step.setResultStderr(maker.gpa, captured.stderr);
    assert(step.result_failed_command != null);
    if (captured.term.success()) return captured.stdout;
    if (!options.allow_failure) return step.fail(maker, "{s} {f}", .{ options.argv[0], captured.term });
    return error.PkgConfigUnavailable;
}