in src/main/java/org/apache/commons/exec/PumpStreamHandler.java [334:351]
private void stop(final Thread thread, final Duration timeout) {
if (thread != null) {
try {
if (timeout.equals(Duration.ZERO)) {
thread.join();
} else {
final Duration timeToWait = timeout.plus(STOP_TIMEOUT_ADDITION);
final Instant startTime = Instant.now();
thread.join(timeToWait.toMillis());
if (Instant.now().isAfter(startTime.plus(timeToWait))) {
caught = new ExecuteException("The stop timeout of " + timeout + " ms was exceeded", Executor.INVALID_EXITVALUE);
}
}
} catch (final InterruptedException e) {
thread.interrupt();
}
}
}