55import java .nio .ByteBuffer ;
66import java .util .concurrent .CompletableFuture ;
77
8+ import com .zaxxer .nuprocess .NuProcess ;
9+
810import io .quarkus .logging .Log ;
911
1012public class OutputRecordingProcessHandler extends BaseProcessHandler {
1113 private final GrowableBuffer stdOutBuffer ;
1214 private final CompletableFuture <InputStream > output = new CompletableFuture <>();
13- private final boolean debug = false ;
15+ private final boolean debug = true ;
16+ private long startTime ;
1417
1518 public OutputRecordingProcessHandler (int bufferSize , String ... command ) {
1619 super (command );
1720 stdOutBuffer = new GrowableBuffer (bufferSize );
1821 }
1922
23+ @ Override
24+ public void onStart (NuProcess nuProcess ) {
25+ super .onStart (nuProcess );
26+ startTime = System .currentTimeMillis ();
27+ }
28+
2029 @ Override
2130 public void onStdout (ByteBuffer buffer , boolean closed ) {
2231 if (buffer .hasRemaining () && !closed ) {
@@ -25,7 +34,9 @@ public void onStdout(ByteBuffer buffer, boolean closed) {
2534 var bytes = new byte [remaining ];
2635 buffer .duplicate ().get (bytes );
2736 final var read = new String (bytes );
28- Log .infof ("=== read %d:\n \n %s\n \n ===\n " , remaining , read );
37+ final var now = System .currentTimeMillis ();
38+ Log .infof ("=== read %d after %dms:\n \n %s\n \n ===\n " , remaining , now - startTime , read );
39+ startTime = now ;
2940 }
3041 stdOutBuffer .put (buffer );
3142 }
0 commit comments