Class ProcessResult
- java.lang.Object
-
- org.kiwiproject.beta.base.process.ProcessResult
-
@Beta public class ProcessResult extends Object
Represents the result of running a command line process. May include data written to stdout or stderr. There will not be an exit code if the process timed out, nor stdout or stderr. There may or may not be an error (represented as a Throwable).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classProcessResult.ProcessResultBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProcessResult.ProcessResultBuilderbuilder()Optional<Throwable>getError()ReturnOptionalcontaining the error, or an empty Optional if the process succeeded.Optional<Integer>getExitCode()ReturnOptionalcontaining the process exit code, or an empty Optional if the process timed out.@NonNull List<String>getStdErrLines()@NonNull List<String>getStdOutLines()intgetTimeoutThresholdMillis()booleanhasError()Return true if this result contains an error.booleanisNotSuccessfulExit()Return true if the exit code is NOT zero, and false for any other value.booleanisSuccessfulExit()Return true if the exit code is zero, and false for any other value.static booleanisSuccessfulExitCode(int exitCode)Return true if exit code is zero, and false for any other value.booleanisTimedOut()
-
-
-
Method Detail
-
isSuccessfulExitCode
public static boolean isSuccessfulExitCode(int exitCode)
Return true if exit code is zero, and false for any other value.
-
getExitCode
public Optional<Integer> getExitCode()
ReturnOptionalcontaining the process exit code, or an empty Optional if the process timed out.
-
isSuccessfulExit
public boolean isSuccessfulExit()
Return true if the exit code is zero, and false for any other value.
-
isNotSuccessfulExit
public boolean isNotSuccessfulExit()
Return true if the exit code is NOT zero, and false for any other value.
-
hasError
public boolean hasError()
Return true if this result contains an error.
-
getError
public Optional<Throwable> getError()
ReturnOptionalcontaining the error, or an empty Optional if the process succeeded.
-
builder
public static ProcessResult.ProcessResultBuilder builder()
-
isTimedOut
public boolean isTimedOut()
-
getTimeoutThresholdMillis
public int getTimeoutThresholdMillis()
-
-