2525import java .io .InputStream ;
2626import java .util .Arrays ;
2727import java .util .concurrent .CompletableFuture ;
28+ import java .util .concurrent .ExecutionException ;
2829import java .util .concurrent .TimeUnit ;
2930import java .util .concurrent .atomic .AtomicInteger ;
3031
@@ -103,7 +104,7 @@ public static String runAndWaitNoLog(int timeoutSeconds, File folder,
103104 }
104105 return StringUtils .EMPTY ;
105106 }
106-
107+
107108 private static class StreamReader implements Runnable {
108109 private final CompletableFuture <String > output = new CompletableFuture <>();
109110 private final InputStream is ;
@@ -115,7 +116,8 @@ private StreamReader(InputStream is) {
115116
116117 private static StreamReader consume (InputStream is , String streamName ) {
117118 StreamReader streamReader = new StreamReader (is );
118- Thread t = new Thread (streamReader , "streamReader-" + id .getAndIncrement () + "-" + streamName );
119+ Thread t = new Thread (streamReader ,
120+ "streamReader-" + id .getAndIncrement () + "-" + streamName );
119121 t .setDaemon (true );
120122 t .start ();
121123 return streamReader ;
@@ -135,9 +137,10 @@ public void run() {
135137 } catch (Exception e ) {
136138 output .completeExceptionally (e );
137139 }
138- };
140+ }
139141
140- public String getOutput () throws Exception {
142+ public String getOutput ()
143+ throws InterruptedException , ExecutionException {
141144 return output .get ();
142145 }
143146 }
0 commit comments