Executes the provided command immediately.
If the program exits successfully, stdout is returned. Otherwise, fails the build with a helpful message.
See also:
runFallible.pub fn run(b: *Build, argv: []const []const u8) []u8
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"),
}),
}
}