| ... | ... | @@ -34,7 +34,8 @@ stderr_action: StdIoAction = .inherit, |
| 34 | 34 | |
| 35 | 35 | stdin_behavior: std.ChildProcess.StdIo = .Inherit, |
| 36 | 36 | |
| 37 | | expected_exit_code: u8 = 0, |
| 37 | /// Set this to `null` to ignore the exit code for the purpose of determining a successful execution |
| 38 | expected_exit_code: ?u8 = 0, |
| 38 | 39 | |
| 39 | 40 | /// Print the command before running it |
| 40 | 41 | print: bool, |
| ... | ... | @@ -220,17 +221,19 @@ fn make(step: *Step) !void { |
| 220 | 221 | }; |
| 221 | 222 | |
| 222 | 223 | switch (term) { |
| 223 | | .Exited => |code| { |
| 224 | | if (code != self.expected_exit_code) { |
| 224 | .Exited => |code| blk: { |
| 225 | const expected_exit_code = self.expected_exit_code orelse break :blk; |
| 226 | |
| 227 | if (code != expected_exit_code) { |
| 225 | 228 | if (self.builder.prominent_compile_errors) { |
| 226 | 229 | std.debug.print("Run step exited with error code {} (expected {})\n", .{ |
| 227 | 230 | code, |
| 228 | | self.expected_exit_code, |
| 231 | expected_exit_code, |
| 229 | 232 | }); |
| 230 | 233 | } else { |
| 231 | 234 | std.debug.print("The following command exited with error code {} (expected {}):\n", .{ |
| 232 | 235 | code, |
| 233 | | self.expected_exit_code, |
| 236 | expected_exit_code, |
| 234 | 237 | }); |
| 235 | 238 | printCmd(cwd, argv); |
| 236 | 239 | } |