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).
  • Method Details

    • 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()
      Return Optional containing 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()
      Return Optional containing the error, or an empty Optional if the process succeeded.
    • builder

      public static ProcessResult.ProcessResultBuilder builder()
    • getStdOutLines

      @NonNull public @NonNull List<String> getStdOutLines()
    • getStdErrLines

      @NonNull public @NonNull List<String> getStdErrLines()
    • isTimedOut

      public boolean isTimedOut()
    • getTimeoutThresholdMillis

      public int getTimeoutThresholdMillis()