code: public static void getCommandResultIntoStream(
  			CommandLine cmdLine, File dir, int expectedExit,
  			long timeout, OutputStream stream, Map<String,String> environment) throws IOException {
  		DefaultExecutor executor = getDefaultExecutor(dir, expectedExit, timeout);
  		executor.setStreamHandler(new PumpStreamHandler(stream));
  		execute(cmdLine, dir, executor, environment);
  	}
docs: Run the given commandline in the given directory and verify that the tool
  has the expected exit code and does finish in the timeout.
  
  @param cmdLine The commandline object filled with the executable and command line arguments
  @param dir The working directory for the command
  @param expectedExit The expected exit value or -1 to not fail on any exit value
  @param timeout The timeout in milliseconds or ExecuteWatchdog.INFINITE_TIMEOUT
  @param stream An OutputStream which receives the output of the executed command
  @param environment Environment variables that should be set for the execution of the command
  
  @throws IOException Execution of subprocess failed or the
  subprocess returned a exit value indicating a failure