From 0344ef7e13bbefc9a8f1976b77e1ef6d0d292cd5 Mon Sep 17 00:00:00 2001 From: Ruben Romero Montes Date: Wed, 23 Jul 2025 11:36:33 +0200 Subject: [PATCH] fix: prefer stdout Signed-off-by: Ruben Romero Montes --- .../redhat/exhort/providers/YarnBerryProcessor.java | 1 + src/main/java/com/redhat/exhort/tools/Operations.java | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java b/src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java index e4fbf4c4..cf4d32f7 100644 --- a/src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java +++ b/src/main/java/com/redhat/exhort/providers/YarnBerryProcessor.java @@ -87,6 +87,7 @@ private boolean isRoot(String name) { return name.endsWith("@workspace:."); } + @Override public String parseDepTreeOutput(String output) { return "[" + output.trim().replace(System.lineSeparator(), "").replace("}{", "},{") + "]"; } diff --git a/src/main/java/com/redhat/exhort/tools/Operations.java b/src/main/java/com/redhat/exhort/tools/Operations.java index f8dfeb6c..ae8ec564 100644 --- a/src/main/java/com/redhat/exhort/tools/Operations.java +++ b/src/main/java/com/redhat/exhort/tools/Operations.java @@ -165,13 +165,13 @@ public static String runProcessGetOutput(Path dir, final String[] cmdList, Strin } String stdout = new String(process.getInputStream().readAllBytes()); - String stderr = new String(process.getErrorStream().readAllBytes()); - // TODO: This should throw an exception if the process fails - if (!stderr.isBlank()) { - return stderr.trim(); + if (!stdout.isBlank()) { + return stdout.trim(); } - return stdout.trim(); + // TODO: This should throw an exception if the process fails + String stderr = new String(process.getErrorStream().readAllBytes()); + return stderr.trim(); } catch (IOException e) { throw new RuntimeException( String.format("Failed to execute command '%s' ", join(" ", cmdList)), e);