Procrun is a library for running an operating system process and obtaining its exit status and what it writes to its standard output and standard error streams.

The ProcessBuilder and Process classes from the java.lang package provide an interface for running a process, but there are a number of additional things that must be done to correctly run a process and read its output. Procrun tries to fill this gap.

Procrun provides the following features:

  1. Ensures the process is terminated on exception or interruption
  2. Reads promptly from the process' standard output and standard error streams to keep the process from blocking or deadlocking
  3. Can read the process' output in various ways including the following: reading and discarding, reading into a growing buffer, and reading into a fixed-size buffer (suitable for limiting the amount of memory used)
  4. Static convenience methods