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 standard library.
std › Build › run Public Function run Doc Source Public Function std.Build.run
pub fn run (b : *Build , argv : []const []const u8 ) []u8 Params b : *Build argv : []const []const u8 File Build.zig: 1812
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829 pub fn run (b : *Build , argv : []const []const u8 ) []u8 {
const graph = b .graph ;
const arena = graph .arena ;
switch (b .runFallible (argv , .{
.stderr_behavior = .inherit ,
})) {
.success => |stdout | return stdout ,
.spawn_failed => |err | fatal ("the following command failed with {t}:\n{s}" , .{
err , std .zig .allocPrintCmd (arena , argv , .{}) catch @panic ("OOM" ),
}),
.bad_exit_code => |code | fatal ("the following command exited with code {d}:\n{s}" , .{
code , std .zig .allocPrintCmd (arena , argv , .{}) catch @panic ("OOM" ),
}),
.crashed => fatal ("the following command crashed:\n{s}" , .{
std .zig .allocPrintCmd (arena , argv , .{}) catch @panic ("OOM" ),
}),
}
}
Executes the provided command immediately.
If the program exits successfully, stdout is returned. Otherwise, fails the build with a helpful message.
See also:
runFallible.