< prev index next > vcs/src/main/java/org/openjdk/skara/vcs/openjdk/convert/HgToGitConverter.java
Print this page
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
+ import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import static java.lang.Integer.parseInt;
Path stderr() {
return stderr;
}
+ int waitForProcess() throws InterruptedException {
+ var finished = process.waitFor(12, TimeUnit.HOURS);
+ if (!finished) {
+ process.destroyForcibly().waitFor();
+ throw new RuntimeException("Command '" + String.join(" ", command) + "' did not finish in 12 hours");
+ }
+ return process.exitValue();
+ }
+
@Override
public void close() throws IOException {
if (stdout != null) {
Files.delete(stdout);
}
return new ProcessInfo(pb.start(), command, stdout, stderr);
}
private void await(ProcessInfo p) throws IOException {
try {
! int res = p.process().waitFor();
if (res != 0) {
var msg = String.join(" ", p.command()) + " exited with status " + res;
log.severe(msg);
throw new IOException(msg);
}
return new ProcessInfo(pb.start(), command, stdout, stderr);
}
private void await(ProcessInfo p) throws IOException {
try {
! int res = p.waitForProcess();
if (res != 0) {
var msg = String.join(" ", p.command()) + " exited with status " + res;
log.severe(msg);
throw new IOException(msg);
}
< prev index next >