Add optional string command execution

This commit is contained in:
crschnick 2023-12-24 17:00:38 +00:00
parent 7bf4b6f4db
commit dba1feb81f

View file

@ -7,6 +7,7 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
@ -90,6 +91,8 @@ public interface CommandControl extends ProcessControl {
String readStdoutAndWait() throws Exception;
Optional<String> readStdoutIfPossible() throws Exception;
default boolean discardAndCheckExit() throws ProcessOutputException {
try {
discardOrThrow();