File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
junit-modular-world/src/build Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -310,19 +310,25 @@ String[] toArray() {
310
310
}
311
311
}
312
312
313
- int run (String tool , String ... args ) {
313
+ void run (String tool , String ... args ) {
314
314
printCommandDetails ("run" , tool , args );
315
- return ToolProvider .findFirst (tool ).get ().run (System .out , System .err , args );
315
+ checkExitCode ( ToolProvider .findFirst (tool ).get ().run (System .out , System .err , args ) );
316
316
}
317
317
318
- int exe (String executable , String ... args ) throws Exception {
318
+ void exe (String executable , String ... args ) throws Exception {
319
319
printCommandDetails ("exe" , executable , args );
320
320
ProcessBuilder processBuilder = new ProcessBuilder (executable );
321
321
Arrays .stream (args ).forEach (processBuilder .command ()::add );
322
322
processBuilder .redirectErrorStream (true );
323
323
Process process = processBuilder .start ();
324
324
process .getInputStream ().transferTo (System .out );
325
- return process .waitFor ();
325
+ checkExitCode (process .waitFor ());
326
+ }
327
+
328
+ private void checkExitCode (int exitCode ) {
329
+ if (exitCode != 0 ) {
330
+ System .exit (exitCode );
331
+ }
326
332
}
327
333
328
334
void printCommandDetails (String context , String command , String ... args ) {
You can’t perform that action at this time.
0 commit comments