mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-25 08:59:25 -04:00
Various small improvements
This commit is contained in:
@@ -80,6 +80,8 @@ public interface CommandControl extends ProcessControl {
|
||||
|
||||
void accumulateStderr(Consumer<String> con);
|
||||
|
||||
public byte[] readRawBytesOrThrow() throws Exception;
|
||||
|
||||
public String readOrThrow() throws Exception;
|
||||
|
||||
public default boolean discardAndCheckExit() throws ProcessOutputException {
|
||||
|
||||
@@ -48,6 +48,12 @@ public interface ShellControl extends ProcessControl {
|
||||
""", script));
|
||||
}
|
||||
|
||||
default byte[] executeSimpleRawBytesCommand(String command) throws Exception {
|
||||
try (CommandControl c = command(command).start()) {
|
||||
return c.readRawBytesOrThrow();
|
||||
}
|
||||
}
|
||||
|
||||
default String executeSimpleStringCommand(String command) throws Exception {
|
||||
try (CommandControl c = command(command).start()) {
|
||||
return c.readOrThrow();
|
||||
|
||||
Reference in New Issue
Block a user