Refactor ProcessRunner to use Duration for wait time in process termination

This commit is contained in:
DerDavidBohl
2025-12-10 13:10:20 +01:00
parent 15ee0f7df4
commit 364fa47ecc

View File

@@ -6,6 +6,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -131,7 +132,7 @@ public class ProcessRunner {
log.debug("Killing child process: {}", child.pid());
child.destroyForcibly();
try {
child.waitFor(2, TimeUnit.SECONDS);
child.wait(Duration.ofSeconds(2).toMillis());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}