jodd-core/src/main/java/jodd/util/ProcessRunner.java
public static ProcessResult run(final Process process) throws InterruptedException {
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();

		final StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), baos, OUTPUT_PREFIX);
		final StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), baos, ERROR_PREFIX);

		outputGobbler.start();
		errorGobbler.start();

		final int result = process.waitFor();

		outputGobbler.waitFor();
		errorGobbler.waitFor();

		return new ProcessResult(result, baos.toString());
	}
public static ProcessResult run(final Process process) throws InterruptedException {
		final ByteArrayOutputStream baos = new ByteArrayOutputStream();

		final StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), baos, OUTPUT_PREFIX);
		final StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), baos, ERROR_PREFIX);

		outputGobbler.start();
		errorGobbler.start();

		final int result = process.waitFor();

		outputGobbler.waitFor();
		errorGobbler.waitFor();

		return new ProcessResult(result, baos.toString());
	}
public static ProcessResult run ( final Process process ) throws InterruptedException { final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; final StreamGobbler outputGobbler = new StreamGobbler ( process . getInputStream ( ) , baos , OUTPUT_PREFIX ) ; final StreamGobbler errorGobbler = new StreamGobbler ( process . getErrorStream ( ) , baos , ERROR_PREFIX ) ; outputGobbler . start ( ) ; errorGobbler . start ( ) ; final int result = process . waitFor ( ) ; outputGobbler . waitFor ( ) ; errorGobbler . waitFor ( ) ; return new ProcessResult ( result , baos . toString ( ) ) ; }
Executes a process and returns the process output and exit code.
Executes a process and returns the process output and exit code .