|
84 | 84 | versionProvider = VersionProvider.class, |
85 | 85 | commandListHeading = "%n@|bold,underline Commands:|@%n", |
86 | 86 | defaultValueProvider = CommandLine.PropertiesDefaultProvider.class, |
87 | | - exitCodeOnInvalidInput = 191, |
88 | | - exitCodeOnExecutionException = 192, |
89 | 87 | resourceBundle = "version", |
90 | 88 | abbreviateSynopsis = true, |
91 | 89 | synopsisHeading = "@|bold,underline Usage:|@%n", |
92 | 90 | customSynopsis = {"@|bold cats|@ @|fg(yellow) -c|@ <CONTRACT> @|fg(yellow) -s|@ <SERVER> [ADDITIONAL OPTIONS]", |
93 | 91 | "@|bold cats (list | replay | run | template | lint | info | stats | validate | random | generate | explain)|@ [OPTIONS]", "%n"}, |
94 | 92 | exitCodeListHeading = "%n@|bold,underline Exit Codes:|@%n", |
95 | 93 | exitCodeList = {"@|bold 0|@:Successful program execution", |
96 | | - "@|bold 191|@:Usage error: user input for the command was incorrect", |
97 | | - "@|bold 192|@:Internal execution error: an exception occurred when executing command", |
98 | | - "@|bold ERR|@:Where ERR is the number of errors reported by cats"}, |
| 94 | + "@|bold 2|@:Usage error: user input for the command was incorrect", |
| 95 | + "@|bold 1|@:Internal execution error: an exception occurred when executing command"}, |
99 | 96 | footerHeading = "%n@|bold,underline Examples:|@%n", |
100 | 97 | footer = {" Run CATS in blackbox mode and only report 500 http error codes:", |
101 | 98 | " cats -c openapi.yml -s http://localhost:8080 -b -k", |
@@ -263,7 +260,7 @@ public void run() { |
263 | 260 | } catch (CatsException | IOException | ExecutionException | IllegalArgumentException e) { |
264 | 261 | logger.fatal("Something went wrong while running CATS: {}", e.toString()); |
265 | 262 | logger.debug("Stacktrace: {}", e); |
266 | | - exitCodeDueToErrors = 192; |
| 263 | + exitCodeDueToErrors = CommandLine.ExitCode.SOFTWARE; |
267 | 264 | } finally { |
268 | 265 | testCaseListener.endSession(); |
269 | 266 | } |
@@ -508,7 +505,10 @@ private List<FuzzingData> filterFuzzingData(List<FuzzingData> fuzzingDataListWit |
508 | 505 |
|
509 | 506 | @Override |
510 | 507 | public int getExitCode() { |
511 | | - return exitCodeDueToErrors + executionStatisticsListener.getErrors(); |
| 508 | + if (exitCodeDueToErrors > 0) { |
| 509 | + return exitCodeDueToErrors; |
| 510 | + } |
| 511 | + return executionStatisticsListener.getErrors() > 0 ? CommandLine.ExitCode.SOFTWARE : CommandLine.ExitCode.OK; |
512 | 512 | } |
513 | 513 |
|
514 | 514 | @Override |
|
0 commit comments