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() {
310310 }
311311 }
312312
313- int run (String tool , String ... args ) {
313+ void run (String tool , String ... args ) {
314314 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 ) );
316316 }
317317
318- int exe (String executable , String ... args ) throws Exception {
318+ void exe (String executable , String ... args ) throws Exception {
319319 printCommandDetails ("exe" , executable , args );
320320 ProcessBuilder processBuilder = new ProcessBuilder (executable );
321321 Arrays .stream (args ).forEach (processBuilder .command ()::add );
322322 processBuilder .redirectErrorStream (true );
323323 Process process = processBuilder .start ();
324324 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+ }
326332 }
327333
328334 void printCommandDetails (String context , String command , String ... args ) {
You can’t perform that action at this time.
0 commit comments