Код: Выделить всё
private ExecWatch execCmd(Pod pod, CompletableFuture data, String... command) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
return this.kubernetesClient.pods().inNamespace(pod.getMetadata().getNamespace())
.withName(pod.getMetadata().getName()).writingOutput(baos).writingError(baos)
.usingListener(new SimpleListener(data, baos)).exec(command);
}
Код: Выделить всё
CompletableFuture data = new CompletableFuture();
try (ExecWatch execWatch = execCmd(pod, data, "ls", "-lrt", "internal_folder/", "| wc -l")) {
result = data.get(executionTimeout.getSeconds(), TimeUnit.SECONDS);
}
Как я могу это сделать?
заранее спасибо.
Подробнее: https://stackoverflow.com/questions/777 ... d-commands