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