mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
build system: print captured stderr on Run step failure
when a Run step that captures stderr fails, no output from it is visible by the user and, since the step failed, any downstream step that would process the captured stream will not run, making it impossible for the user to see the stderr output from the failed process invocation, which makes for a frustrating puzzle when this happens in CI.
This commit is contained in:
parent
eb1a4970da
commit
de23ccfad1
1 changed files with 10 additions and 0 deletions
|
|
@ -1391,6 +1391,16 @@ fn runCommand(
|
|||
}
|
||||
},
|
||||
else => {
|
||||
// On failure, print stderr if captured.
|
||||
const bad_exit = switch (result.term) {
|
||||
.Exited => |code| code != 0,
|
||||
.Signal, .Stopped, .Unknown => true,
|
||||
};
|
||||
|
||||
if (bad_exit) if (result.stdio.stderr) |err| {
|
||||
try step.addError("stderr:\n{s}", .{err});
|
||||
};
|
||||
|
||||
try step.handleChildProcessTerm(result.term, cwd, final_argv);
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue