com.judoscript.util
Class ExecuteCmdline

java.lang.Object
  extended by com.judoscript.util.ExecuteCmdline

public class ExecuteCmdline
extends java.lang.Object

This class takes a command line to run either one program or more programs that form a chain of pipes.

A single program, whether in the pipe or not, can take redirections: input redirection is by < file; output is:

   -------------------------------------------------
   Output Redirection        Write To     Append To
   -------------------------------------------------
   output:                   > file       >> file
                             1> file      1>> file
   error:                    2> file      2>> file
   error to output:          2>&1
   error to output to file:  2>&1 file    2>>&1 file
   output to error:          1>&2
   output to error to file:  1>&2 file    1>>&2 file
   -------------------------------------------------
Can have output to one file and error to another. When >& occurs, this should be the only output redirection.


Constructor Summary
ExecuteCmdline(java.lang.String cmdline)
           
 
Method Summary
 int exec(java.lang.String[] env, java.lang.String workdir, java.io.BufferedReader instrm, LinePrintWriter outstrm, LinePrintWriter errstrm, boolean wait, int timeout, boolean extInput, boolean extOutput)
           
 java.io.BufferedReader getInput()
           
 LinePrintWriter getOutput()
           
 int waitOn()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecuteCmdline

public ExecuteCmdline(java.lang.String cmdline)
               throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

exec

public int exec(java.lang.String[] env,
                java.lang.String workdir,
                java.io.BufferedReader instrm,
                LinePrintWriter outstrm,
                LinePrintWriter errstrm,
                boolean wait,
                int timeout,
                boolean extInput,
                boolean extOutput)
         throws java.io.IOException,
                java.lang.IllegalArgumentException,
                java.lang.InterruptedException
Parameters:
wait - if true, and extInput and extOutput are both false, then it waits.
extInput - if true, the caller wants to take over the input to the first program.
extOutput - if true, the caller wants to take over the output to the last program.
Throws:
java.io.IOException
java.lang.IllegalArgumentException
java.lang.InterruptedException

waitOn

public int waitOn()
           throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

getOutput

public LinePrintWriter getOutput()

getInput

public java.io.BufferedReader getInput()