public final class VerboseProcess extends Object
stdout
from a running process
and logging it through SLF4J.
For example:
String name = new VerboseProcess( new ProcessBuilder("who", "am", "i") ).stdout();
The class throws an exception if the process returns a non-zero exit code.
The class is immutable and thread-safe.
Constructor and Description |
---|
VerboseProcess(Process prc)
Public ctor.
|
VerboseProcess(ProcessBuilder builder)
Public ctor (builder will be configured to redirect error stream to
the
stdout and will receive an empty stdin ). |
public VerboseProcess(@NotNull Process prc)
prc
- The process to work withpublic VerboseProcess(@NotNull ProcessBuilder builder)
stdout
and will receive an empty stdin
).builder
- Process builder to work withpublic String stdout()
stdout
from the process, after its finish (the method will
wait for the process and log its output).stdout
of the processCopyright © 2012-2013 jcabi.com. All Rights Reserved.