Process That Logs And Consumes Output
VerboseProcess
logs output of a java Process
and consumes its output at the same time, for example:
public class Main { public static void main(String[] args) { String name = new VerboseProcess( new ProcessBuilder("who", "am", "i") ).stdout(); System.out.println("I am: " + name); } }
VerboseProcess
throws an exception if the process returns a non-zero exit code.
The only dependency you need is (you can also download jcabi-log-0.24.3.jar
and add it to the classpath):
<dependency> <groupId>com.jcabi</groupId> <artifactId>jcabi-log</artifactId> <version>0.24.3</version> </dependency>