public String execute(ErrorHandler errorHandler, String... commands) throws IOException, InterruptedException { ProcessResult result = run(commands); if (result.exitCode() != 0) { errorHandler.handle(result.exitCode(), result.output(), executable.commandName(), commands); } return result.output(); }
private ProcessResult run(String... commands) throws IOException, InterruptedException { Process process = executable.execute(commands); ExecutorService exec = newSingleThreadExecutor(); Future<String> outputProcessing = exec .submit(() -> processOutputFrom(process)); String output = waitForResultFrom(outputProcessing); process.waitFor(MINUTES_TO_WAIT_AFTER_STD_OUT_CLOSES, TimeUnit.MINUTES); exec.shutdown(); return new ProcessResult(process.exitValue(), output); }
private ProcessResult run(String... commands) throws IOException, InterruptedException { Process process = executable.execute(commands); ExecutorService exec = newSingleThreadExecutor(); Future<String> outputProcessing = exec .submit(() -> processOutputFrom(process)); String output = waitForResultFrom(outputProcessing); process.waitFor(MINUTES_TO_WAIT_AFTER_STD_OUT_CLOSES, TimeUnit.MINUTES); exec.shutdown(); return new ProcessResult(process.exitValue(), output); }
public String execute(ErrorHandler errorHandler, String... commands) throws IOException, InterruptedException { ProcessResult result = run(commands); if (result.exitCode() != 0) { errorHandler.handle(result.exitCode(), result.output(), executable.commandName(), commands); } return result.output(); }
private ProcessResult run(String... commands) throws IOException, InterruptedException { Process process = executable.execute(commands); ExecutorService exec = newSingleThreadExecutor(); Future<String> outputProcessing = exec .submit(() -> processOutputFrom(process)); String output = waitForResultFrom(outputProcessing); process.waitFor(MINUTES_TO_WAIT_AFTER_STD_OUT_CLOSES, TimeUnit.MINUTES); exec.shutdown(); return new ProcessResult(process.exitValue(), output); }
public String execute(ErrorHandler errorHandler, String... commands) throws IOException, InterruptedException { ProcessResult result = run(commands); if (result.exitCode() != 0) { errorHandler.handle(result.exitCode(), result.output(), executable.commandName(), commands); } return result.output(); }