zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit c54a7ca4b25a0ffe080a80fb19986142c98b124e (tree)
parent 12c2de6ee205857e9ca0bcef4aa4d901fc5cc772
Author: Lee Cannon <leecannon@leecannon.xyz>
Date:   Thu, 20 Jan 2022 03:42:27 +0000

allow `expected_exit_code` to be `null`

Diffstat:
Mlib/std/build/RunStep.zig | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/std/build/RunStep.zig b/lib/std/build/RunStep.zig @@ -34,7 +34,8 @@ stderr_action: StdIoAction = .inherit, stdin_behavior: std.ChildProcess.StdIo = .Inherit, -expected_exit_code: u8 = 0, +/// Set this to `null` to ignore the exit code for the purpose of determining a successful execution +expected_exit_code: ?u8 = 0, /// Print the command before running it print: bool, @@ -220,17 +221,19 @@ fn make(step: *Step) !void { }; switch (term) { - .Exited => |code| { - if (code != self.expected_exit_code) { + .Exited => |code| blk: { + const expected_exit_code = self.expected_exit_code orelse break :blk; + + if (code != expected_exit_code) { if (self.builder.prominent_compile_errors) { std.debug.print("Run step exited with error code {} (expected {})\n", .{ code, - self.expected_exit_code, + expected_exit_code, }); } else { std.debug.print("The following command exited with error code {} (expected {}):\n", .{ code, - self.expected_exit_code, + expected_exit_code, }); printCmd(cwd, argv); }