nl.uva.vlet.exec
Class LocalExec

java.lang.Object
  extended by nl.uva.vlet.exec.LocalExec

public class LocalExec
extends java.lang.Object

Helper class for local execution of script/commands etc. is Factory class for LocalProcess.


Constructor Summary
LocalExec()
           
 
Method Summary
static LocalProcess execute(java.lang.String[] cmds, boolean wait)
          Execute cmds[0] and return Process object.
static java.lang.String[] simpleExecute(java.lang.String[] cmds)
          Direct execute command and return result as String array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalExec

public LocalExec()
Method Detail

simpleExecute

public static java.lang.String[] simpleExecute(java.lang.String[] cmds)
                                        throws VlException
Direct execute command and return result as String array.

The String array cmds[] holds the command and argument to execute. cmds[0] is the command to execute and cmds[1]...cmds[n] are the arguments. Method blocks until process has terminated!

Methods returns String array result[] which has at:

  • result[0] complete output of stdout
  • result[1] complete output of stderr;
  • result[2] has the exit value in String value.

    This method assumes no big output of text. Resulting String array (or array elements) might be null upon error.

    Throws:
    VlException

  • execute

    public static LocalProcess execute(java.lang.String[] cmds,
                                       boolean wait)
                                throws VlException
    Execute cmds[0] and return Process object. Returns Process object of terminated process or when wait=false the Process object of running process.

    Parameters:
    wait: - wait until process completes.
    Throws:
    VlException