public static void process(Process p,LineConsumer stdout) throws IOException {
  try (BufferedReader inputReader=new BufferedReader(new InputStreamReader(p.getInputStream()))){
    String line;
    while ((line=inputReader.readLine()) != null) {
      stdout.writeLine(line);
    }
  }
 }

public static void process ( Process p , LineConsumer stdout ) throws IOException { try ( BufferedReader inputReader = new BufferedReader ( new InputStreamReader ( p . getInputStream ( ) ) ) ) { String line ; while ( ( line = inputReader . readLine ( ) ) != null ) { stdout . writeLine ( line ) ; } } }
writes stdout of the process to consumer . < br > supposes that stderr of the process is redirected to stdout .
