From dba1feb81fbaebdbb8ef26b74520fdaf92310b8e Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 24 Dec 2023 17:00:38 +0000 Subject: [PATCH] Add optional string command execution --- core/src/main/java/io/xpipe/core/process/CommandControl.java | 3 +++ 1 file changed, 3 insertions(+) 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 31f95e0d..c487d007 100644 --- a/core/src/main/java/io/xpipe/core/process/CommandControl.java +++ b/core/src/main/java/io/xpipe/core/process/CommandControl.java @@ -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 readStdoutIfPossible() throws Exception; + default boolean discardAndCheckExit() throws ProcessOutputException { try { discardOrThrow();