code: public static List<String> captureOutAndError(List<String> cmd, 
                                                  File stdoutFilename,
                                                  File stderrFilename,
                                                  long tailLength
                                                 ) throws IOException {
      return captureOutAndError(null, cmd, stdoutFilename,
                                stderrFilename, tailLength, false);
    }
docs: Wrap a command in a shell to capture stdout and stderr to files.
  If the tailLength is 0, the entire output will be saved.
  @param cmd The command and the arguments that should be run
  @param stdoutFilename The filename that stdout should be saved to
  @param stderrFilename The filename that stderr should be saved to
  @param tailLength The length of the tail to be saved.
  @return the modified command that should be run