@@ -69,7 +69,7 @@ static boolean check(int timeout, String command, String... args) {
69
69
}
70
70
return exitValue == 0 ;
71
71
} else {
72
- log .trace ("Timed out waiting for command %s to complete" , list );
72
+ log .trace ("Timed out after waiting %d ms for command %s to complete" , timeout , list );
73
73
}
74
74
} catch (InterruptedException e ) {
75
75
Thread .currentThread ().interrupt ();
@@ -358,33 +358,31 @@ IOException getError() {
358
358
error = "" ;
359
359
}
360
360
try {
361
- if (!process .waitFor (request .getConfig ().getSocketTimeout (), TimeUnit .MILLISECONDS )) {
362
- return new IOException ("Timed out waiting for command to terminate" );
361
+ int exitValue = process .waitFor ();
362
+ if (exitValue != 0 ) {
363
+ if (error .isEmpty ()) {
364
+ error = ClickHouseUtils .format ("Command exited with value %d" , exitValue );
365
+ } else {
366
+ int index = error .trim ().indexOf ('\n' );
367
+ error = index > 0 ? error .substring (index + 1 ) : error ;
368
+ }
369
+ } else {
370
+ if (!error .isEmpty ()) {
371
+ // TODO update response summary
372
+ log .trace (() -> {
373
+ for (String line : error .split ("\n " )) {
374
+ log .trace (line );
375
+ }
376
+ return "" ;
377
+ });
378
+ }
379
+ error = "" ;
363
380
}
364
381
} catch (InterruptedException e ) {
365
382
Thread .currentThread ().interrupt ();
366
383
process .destroyForcibly ();
367
384
throw new CompletionException (e );
368
385
}
369
- if (process .exitValue () != 0 ) {
370
- if (error .isEmpty ()) {
371
- error = ClickHouseUtils .format ("Command exited with value %d" , process .exitValue ());
372
- } else {
373
- int index = error .trim ().indexOf ('\n' );
374
- error = index > 0 ? error .substring (index + 1 ) : error ;
375
- }
376
- } else {
377
- if (!error .isEmpty ()) {
378
- // TODO update response summary
379
- log .trace (() -> {
380
- for (String line : error .split ("\n " )) {
381
- log .trace (line );
382
- }
383
- return "" ;
384
- });
385
- }
386
- error = "" ;
387
- }
388
386
}
389
387
return !ClickHouseChecker .isNullOrBlank (error ) ? new IOException (error ) : null ;
390
388
}
0 commit comments