mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 15:10:23 +00:00
Command read rework
This commit is contained in:
parent
f6c06b38c3
commit
e6b6d9b325
2 changed files with 6 additions and 4 deletions
|
@ -18,8 +18,10 @@ public class ShellExecExchangeImpl extends ShellExecExchange {
|
|||
AtomicReference<String> 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()
|
||||
|
|
|
@ -69,9 +69,9 @@ public interface CommandControl extends ProcessControl {
|
|||
|
||||
void withStdoutOrThrow(FailableConsumer<InputStreamReader, Exception> c);
|
||||
|
||||
String readStdoutDiscardErr() throws Exception;
|
||||
String[] readStdoutAndStderr() throws Exception;
|
||||
|
||||
String readJoinedOutputOrThrow() throws Exception;
|
||||
String readStdoutDiscardErr() throws Exception;
|
||||
|
||||
String readStderrDiscardStdout() throws Exception;
|
||||
|
||||
|
|
Loading…
Reference in a new issue