throw new RuntimeException(e);
}
}
public static void runInteractiveProcess(Process process, InputStream inputStream, PrintStream printStream) throws ProcessNonZeroExitCodeException {
final InteractiveProcess interactiveProcess = new InteractiveProcess(process, inputStream, printStream);
new Thread() {
public void run() {
interactiveProcess.connect();
}
}.start();
try {
int exitCode = interactiveProcess.waitFor();
if (exitCode != 0) {
throw new ProcessNonZeroExitCodeException(process, exitCode);
}
} catch (InterruptedException e) {
LOG.info("InterruptedException!, killing the process", e);
interactiveProcess.destroy();
} finally {
interactiveProcess.disconnect();
}
}