Skip to content

Commit

Permalink
Add non-zero exit code for exceptions in CLI tools, fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
hajduakos committed Sep 28, 2020
1 parent c10037d commit 03b741c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {

allprojects {
group = "hu.bme.mit.inf.theta"
version = "2.5.1"
version = "2.6.0"

apply(from = rootDir.resolve("gradle/shared-with-buildSrc/mirrors.gradle.kts"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ private void run() {
}
} catch (final Throwable ex) {
printError(ex);
}
if (benchmarkMode) {
writer.newRow();
System.exit(1);
}
}

Expand Down Expand Up @@ -248,13 +246,15 @@ private void printResult(final SafetyResult<?, ?> status, final long totalTimeMs
} else {
writer.cell("");
}
writer.newRow();
}
}

private void printError(final Throwable ex) {
final String message = ex.getMessage() == null ? "" : ex.getMessage();
if (benchmarkMode) {
writer.cell("[EX] " + ex.getClass().getSimpleName() + ": " + message);
writer.newRow();
} else {
logger.write(Level.RESULT, "%s occurred, message: %s%n", ex.getClass().getSimpleName(), message);
if (stacktrace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ private void run() {
}
} catch (final Throwable ex) {
printError(ex);
}
if (benchmarkMode) {
writer.newRow();
System.exit(1);
}
}

Expand Down Expand Up @@ -221,13 +219,15 @@ private void printResult(final SafetyResult<?, ?> status, final STS sts, final l
}
writer.cell(sts.getVars().size());
writer.cell(ExprUtils.nodeCountSize(BoolExprs.And(sts.getInit(), sts.getTrans())));
writer.newRow();
}
}

private void printError(final Throwable ex) {
final String message = ex.getMessage() == null ? "" : ex.getMessage();
if (benchmarkMode) {
writer.cell("[EX] " + ex.getClass().getSimpleName() + ": " + message);
writer.newRow();
} else {
logger.write(Level.RESULT, "%s occurred, message: %s%n", ex.getClass().getSimpleName(), message);
if (stacktrace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ private void run() {
}
} catch (final Throwable ex) {
printError(ex);
}
if (benchmarkMode) {
writer.newRow();
System.exit(1);
}
}

Expand Down Expand Up @@ -201,13 +199,15 @@ private void printResult(final SafetyResult<?, ?> status, final XSTS sts, final
writer.cell("");
}
writer.cell(sts.getVars().size());
writer.newRow();
}
}

private void printError(final Throwable ex) {
final String message = ex.getMessage() == null ? "" : ex.getMessage();
if (benchmarkMode) {
writer.cell("[EX] " + ex.getClass().getSimpleName() + ": " + message);
writer.newRow();
} else {
logger.write(Logger.Level.RESULT, "%s occurred, message: %s%n", ex.getClass().getSimpleName(), message);
if (stacktrace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private void run() {
}
} catch (final Throwable ex) {
printError(ex);
System.exit(1);
}
}

Expand Down

0 comments on commit 03b741c

Please sign in to comment.