util
Class SystemProcess

java.lang.Object
  extended by util.SystemProcess

public class SystemProcess
extends Object

Class that helps executing a system processes. Adds a timeout, if requested.


Nested Class Summary
private static class SystemProcess.Watcher
          A timer task that interrups a particular thread in its run method.
 
Constructor Summary
SystemProcess()
           
 
Method Summary
static int execute(String[] cmd, long timeout)
          Does a timed execution of a process.
static int execute(String[] cmd, String[] env, File dir, long timeout)
          Does a timed execution of a process.
static int execute(String[] cmd, String[] env, long timeout)
          Does a timed execution of a process.
static int execute(String cmd, long timeout)
          Does a timed execution of a process.
static int execute(String cmd, String[] env, File dir, long timeout)
          Does a timed execution of a process.
static int execute(String cmd, String[] env, long timeout)
          Does a timed execution of a process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemProcess

public SystemProcess()
Method Detail

execute

public static final int execute(String cmd,
                                long timeout)
                         throws IOException,
                                TimeoutException
Does a timed execution of a process. Convenience method, splits the command line on token separators.

Throws:
IOException
TimeoutException

execute

public static final int execute(String[] cmd,
                                long timeout)
                         throws IOException,
                                TimeoutException
Does a timed execution of a process. If the system process has not returned after the specified time-out, it is killed.

Throws:
IOException
TimeoutException

execute

public static final int execute(String cmd,
                                String[] env,
                                long timeout)
                         throws IOException,
                                TimeoutException
Does a timed execution of a process. Convenience method, splits the command line on token separators.

Throws:
IOException
TimeoutException

execute

public static final int execute(String[] cmd,
                                String[] env,
                                long timeout)
                         throws IOException,
                                TimeoutException
Does a timed execution of a process. If the system process has not returned after the specified time-out, it is killed.

Throws:
IOException
TimeoutException

execute

public static final int execute(String cmd,
                                String[] env,
                                File dir,
                                long timeout)
                         throws IOException,
                                TimeoutException
Does a timed execution of a process. Convenience method, splits the command line on token separators.

Throws:
IOException
TimeoutException

execute

public static final int execute(String[] cmd,
                                String[] env,
                                File dir,
                                long timeout)
                         throws IOException,
                                TimeoutException
Does a timed execution of a process. If the system process has not returned after the specified time-out, it is killed.

Throws:
IOException
TimeoutException