Class Shell.Result

  • Enclosing class:
    Shell

    public static final class Shell.Result
    extends java.lang.Object
    Captures the result of executing a command.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String command()
      Returns a string that describes the command that was executed to produce this result.
      int exitCode()
      Returns the exit code of the command.
      java.lang.String output()
      Returns the merged output that the command sent to stdout and stderr as a string.
      java.lang.String[] tokens()
      Returns a copy of the command tokens that were executed to produce this result.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • command

        public java.lang.String command()
        Returns a string that describes the command that was executed to produce this result.
        Returns:
        a string describing the command that is formed by concatenating the command tokens
      • tokens

        public java.lang.String[] tokens()
        Returns a copy of the command tokens that were executed to produce this result.
        Returns:
        a copy of the parsed command tokens
      • output

        public java.lang.String output()
        Returns the merged output that the command sent to stdout and stderr as a string.
        Returns:
        the command's console output
      • exitCode

        public int exitCode()
        Returns the exit code of the command. An exit code of 0 indicates success; other values typically indicate errors, but there is no standard mapping of exit codes to specific errors.
        Returns:
        the exit code returned by the application
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object