| ... | @@ -34,7 +34,8 @@ stderr_action: StdIoAction = .inherit, | ... | @@ -34,7 +34,8 @@ stderr_action: StdIoAction = .inherit, |
| 34 | | 34 | |
| 35 | stdin_behavior: std.ChildProcess.StdIo = .Inherit, | 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 | /// Print the command before running it | 40 | /// Print the command before running it |
| 40 | print: bool, | 41 | print: bool, |
| ... | @@ -220,17 +221,19 @@ fn make(step: *Step) !void { | ... | @@ -220,17 +221,19 @@ fn make(step: *Step) !void { |
| 220 | }; | 221 | }; |
| 221 | | 222 | |
| 222 | switch (term) { | 223 | switch (term) { |
| 223 | .Exited => |code| { | 224 | .Exited => |code| blk: { |
| 224 | if (code != self.expected_exit_code) { | 225 | const expected_exit_code = self.expected_exit_code orelse break :blk; |
| | 226 | |
| | 227 | if (code != expected_exit_code) { |
| 225 | if (self.builder.prominent_compile_errors) { | 228 | if (self.builder.prominent_compile_errors) { |
| 226 | std.debug.print("Run step exited with error code {} (expected {})\n", .{ | 229 | std.debug.print("Run step exited with error code {} (expected {})\n", .{ |
| 227 | code, | 230 | code, |
| 228 | self.expected_exit_code, | 231 | expected_exit_code, |
| 229 | }); | 232 | }); |
| 230 | } else { | 233 | } else { |
| 231 | std.debug.print("The following command exited with error code {} (expected {}):\n", .{ | 234 | std.debug.print("The following command exited with error code {} (expected {}):\n", .{ |
| 232 | code, | 235 | code, |
| 233 | self.expected_exit_code, | 236 | expected_exit_code, |
| 234 | }); | 237 | }); |
| 235 | printCmd(cwd, argv); | 238 | printCmd(cwd, argv); |
| 236 | } | 239 | } |