in terraform-client/src/main/java/com/microsoft/terraform/ProcessLauncher.java [63:88]
CompletableFuture<Integer> launch() {
assert this.process == null;
if (this.inheritIO) {
this.builder.inheritIO();
}
try {
this.process = this.builder.start();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
if (!this.inheritIO) {
if (this.outputListener != null) {
this.executor.submit(() -> this.readProcessStream(this.process.getInputStream(), this.outputListener));
}
if (this.errorListener != null) {
this.executor.submit(() -> this.readProcessStream(this.process.getErrorStream(), this.errorListener));
}
}
return CompletableFuture.supplyAsync(() -> {
try {
return this.process.waitFor();
} catch (InterruptedException ex) {
throw new RuntimeException(ex);
}
}, this.executor);
}