Class ExecResult

  • All Implemented Interfaces:
    Serializable

    public class ExecResult
    extends Object
    implements Serializable
    Wraps result of the command-line execution:
    • executed command line,
    • output buffer,
    • return code,
    • java Exception.
    Author:
    tiry
    See Also:
    Serialized Form
    • Field Detail

      • commandLine

        protected final String commandLine
      • execTime

        protected final long execTime
      • success

        protected boolean success
      • returnCode

        protected int returnCode
    • Constructor Detail

      • ExecResult

        public ExecResult​(String commandLine,
                          List<String> output,
                          long execTime,
                          int returnCode)
      • ExecResult

        public ExecResult​(String timeoutError)
        Creates a timeout error result.
        Since:
        2021.41
    • Method Detail

      • getExecTime

        public long getExecTime()
      • isSuccessful

        public boolean isSuccessful()
      • getError

        public CommandException getError()
        Rather rely on isSuccessful() to check for the execution success. Note however that since 5.7.3, the getError() method cannot return null even if the execution failed (it was not the case before).
        Returns:
        CommandException attached to the result, optionally wrapping the root cause.
      • getReturnCode

        public int getReturnCode()
      • getCommandLine

        public String getCommandLine()
        Returns:
        the executed command line
        Since:
        5.5
      • isCommandInTimeout

        public boolean isCommandInTimeout()