2
0
Fork 0
mirror of https://github.com/ethauvin/bld.git synced 2025-04-25 16:27:11 -07:00

Interrupt execution when exception triggers during command execution.

Minor refactoring.
This commit is contained in:
Geert Bevin 2024-06-26 08:02:02 -04:00
parent c912e4396e
commit b9ac76b5b5

View file

@ -250,8 +250,20 @@ public class BuildExecutor {
break; break;
} }
} catch (Throwable e) { } catch (Throwable e) {
exitStatus(1); exitStatus(ExitStatusException.EXIT_FAILURE);
outputCommandExecutionException(e);
break;
}
}
if (outputJson() && exitStatus_ == ExitStatusException.EXIT_SUCCESS) {
System.out.println(json_template.getContent());
}
return exitStatus_;
}
private void outputCommandExecutionException(Throwable e) {
if (outputJson()) { if (outputJson()) {
var t = TemplateFactory.JSON.get("bld.executor_error"); var t = TemplateFactory.JSON.get("bld.executor_error");
if (showStacktrace) { if (showStacktrace) {
@ -299,14 +311,6 @@ public class BuildExecutor {
} }
} }
} }
}
if (outputJson() && exitStatus_ == ExitStatusException.EXIT_SUCCESS) {
System.out.println(json_template.getContent());
}
return exitStatus_;
}
/** /**
* Starts the execution of the build. This method will call * Starts the execution of the build. This method will call
@ -554,7 +558,7 @@ public class BuildExecutor {
System.err.println(); System.err.println();
System.err.println("ERROR: " + message); System.err.println("ERROR: " + message);
} }
exitStatus(1); exitStatus(ExitStatusException.EXIT_FAILURE);
return false; return false;
} }
return true; return true;