net.sourceforge.cruisecontrol.util
Class Processes

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.util.Processes

public final class Processes
extends java.lang.Object

Utility methods for interacting with Java processes.

See Also:
Process

Method Summary
static java.lang.Process execute(Commandline c)
           
static void executeFully(Commandline c)
           
static int waitFor(java.lang.Process proc, org.apache.log4j.Logger log)
          Waits for a process to finish executing and logs the output.
static int waitFor(java.lang.Process proc, StreamConsumer output, StreamConsumer error)
          Waits for a process to finish executing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

executeFully

public static void executeFully(Commandline c)
                         throws java.io.IOException,
                                java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException

execute

public static java.lang.Process execute(Commandline c)
                                 throws java.io.IOException
Throws:
java.io.IOException

waitFor

public static int waitFor(java.lang.Process proc,
                          org.apache.log4j.Logger log)
                   throws java.io.IOException,
                          java.lang.InterruptedException
Waits for a process to finish executing and logs the output.

Parameters:
proc - the process.
log - where to log both standard and error output.
Returns:
the process' exit value
Throws:
java.io.IOException
java.lang.InterruptedException

waitFor

public static int waitFor(java.lang.Process proc,
                          StreamConsumer output,
                          StreamConsumer error)
                   throws java.io.IOException,
                          java.lang.InterruptedException
Waits for a process to finish executing.

Parameters:
proc - the process.
output - consumes the process' standard output.
error - consumes the process' error output.
Returns:
the process' exit value
Throws:
java.io.IOException
java.lang.InterruptedException