question: public static void process ( Process p , LineConsumer stdout , LineConsumer stderr ) throws IOException { try ( BufferedReader inputReader = new BufferedReader ( new InputStreamReader ( p . getInputStream ( ) ) ) ; BufferedReader errorReader = new BufferedReader ( new InputStreamReader ( p . getErrorStream ( ) ) ) ) { String line ; while ( ( line = inputReader . readLine ( ) ) != null ) { stdout . writeLine ( line ) ; } while ( ( line = errorReader . readLine ( ) ) != null ) { stderr . writeLine ( line ) ; } } }
target:  Writes stdout and stderr of the process to consumers.<br> Supposes that stderr of the process is redirected to stdout.