Procrun is a library for running an OS process and obtaining its exit
status, standard output output, and standard error output.
The ProcessBuilder and Process classes from the
java.lang package provide a start, but there are a number of
additional things that must be done to correctly run a process and read its
output. Procrun fills this gap.
Procrun provides the following features:
- Ensures the process is terminated on exception or interruption
- Ensures the process is terminated on VM exit
- Process can be run and terminated by interacting with a single class
instance
- Reads promptly from the process' standard output and standard error to
keep the process from blocking or deadlocking
- Can read the process' output in various ways: reading and discarding,
reading into a growing buffer, and reading into a fixed-size buffer (suitable
for limiting the amount of memory used)
- Static convenience methods for a short way to run a process and get a
result