de.cau.cs.kieler.esterel.cec
Class KonsoleExec

java.lang.Object
  extended by de.cau.cs.kieler.esterel.cec.KonsoleExec

public final class KonsoleExec
extends Object

Utility class to execute external programs.

Rating red

Method Summary
static InputStream exec(String cmd, InputStream input, int inittime, int timeout, int steptime)
          Run an external process with a timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exec

public static InputStream exec(String cmd,
                               InputStream input,
                               int inittime,
                               int timeout,
                               int steptime)
                        throws KielerException
Run an external process with a timeout. This method works for Linux/Mac and Windows.

Parameters:
cmd - command that is actually executed
input - the input that is feed to the executed program (stdin)
inittime - time initialy, the process has this amount of time to produe the initial output.
timeout - the process is terminated timeout milliseconds after the last output was generated
steptime - time in milliseconds to wait between polling for output
Returns:
the output that was generated by the program (stdout)
Throws:
KielerException - throw for communication errors or if the return value of the process is not 0. In this case, also the error stream is contained in the exception.