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 @@ -309,19 +309,25 @@ String[] toArray() {
309
309
}
310
310
}
311
311
312
- int run (String tool , String ... args ) {
312
+ void run (String tool , String ... args ) {
313
313
printCommandDetails ("run" , tool , args );
314
- return ToolProvider .findFirst (tool ).get ().run (System .out , System .err , args );
314
+ checkExitCode ( ToolProvider .findFirst (tool ).get ().run (System .out , System .err , args ) );
315
315
}
316
316
317
- int exe (String executable , String ... args ) throws Exception {
317
+ void exe (String executable , String ... args ) throws Exception {
318
318
printCommandDetails ("exe" , executable , args );
319
319
ProcessBuilder processBuilder = new ProcessBuilder (executable );
320
320
Arrays .stream (args ).forEach (processBuilder .command ()::add );
321
321
processBuilder .redirectErrorStream (true );
322
322
Process process = processBuilder .start ();
323
323
process .getInputStream ().transferTo (System .out );
324
- return process .waitFor ();
324
+ checkExitCode (process .waitFor ());
325
+ }
326
+
327
+ private void checkExitCode (int exitCode ) {
328
+ if (exitCode != 0 ) {
329
+ System .exit (exitCode );
330
+ }
325
331
}
326
332
327
333
void printCommandDetails (String context , String command , String ... args ) {
You can’t perform that action at this time.
0 commit comments