Class RunCommand.Status

  • Enclosing class:
    RunCommand

    public static class RunCommand.Status
    extends Object
    Represents the status of a process that has been executed. Captures the command, exit status, and lines written to standard output and error.
    • Field Detail

      • command

        public final List<String> command
        The command executed.
      • exitStatus

        public final int exitStatus
        The exit status of the command.
      • timedOut

        public final boolean timedOut
        Whether the command process timed out.
      • standardOutputLines

        public final List<String> standardOutputLines
        The output from running the command.
      • errorOutputLines

        public final List<String> errorOutputLines
        The error output from running the command.
    • Constructor Detail

      • Status

        Status​(List<String> command,
               int exitStatus,
               boolean timedOut,
               List<String> standardOutputLines,
               List<String> errorOutputLines)
        Creates a RunCommand.Status object for the command with captured exit status and output.

        The output from command execution is captured as a List of output lines. This avoids losing output from the command if the process is destroyed.

        Parameters:
        command - the command
        exitStatus - the exit status
        timedOut - whether the process timed out
        standardOutputLines - the lines of process output to standard output
        errorOutputLines - the lines of process output to standard error
    • Method Detail

      • describeLines

        private void describeLines​(String source,
                                   List<String> lines,
                                   StringBuilder sb)
        Print to sb the lines, or say how many lines there were.
        Parameters:
        source - the source of the lines, such as "stdout" or "stderr"
        lines - the lines
        sb - where to print the represenation