diff --git a/app/src/main/java/io/xpipe/app/beacon/impl/ShellExecExchangeImpl.java b/app/src/main/java/io/xpipe/app/beacon/impl/ShellExecExchangeImpl.java index 0cc843f2d..738fe60fe 100644 --- a/app/src/main/java/io/xpipe/app/beacon/impl/ShellExecExchangeImpl.java +++ b/app/src/main/java/io/xpipe/app/beacon/impl/ShellExecExchangeImpl.java @@ -18,8 +18,10 @@ public class ShellExecExchangeImpl extends ShellExecExchange { AtomicReference err = new AtomicReference<>(); long exitCode; try (var command = existing.getControl().command(msg.getCommand()).start()) { - command.accumulateStdout(s -> out.set(s)); - command.accumulateStderr(s -> err.set(s)); + var r = command.readStdoutAndStderr(); + out.set(r[0]); + err.set(r[1]); + command.close(); exitCode = command.getExitCode(); } return Response.builder() diff --git a/core/src/main/java/io/xpipe/core/process/CommandControl.java b/core/src/main/java/io/xpipe/core/process/CommandControl.java index 34de3bf00..7849cf087 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandControl.java +++ b/core/src/main/java/io/xpipe/core/process/CommandControl.java @@ -69,9 +69,9 @@ public interface CommandControl extends ProcessControl { void withStdoutOrThrow(FailableConsumer c); - String readStdoutDiscardErr() throws Exception; + String[] readStdoutAndStderr() throws Exception; - String readJoinedOutputOrThrow() throws Exception; + String readStdoutDiscardErr() throws Exception; String readStderrDiscardStdout() throws Exception;