org.enhydra.xml.xmlc.misc
Class ProcessRunner

java.lang.Object
  |
  +--org.enhydra.xml.xmlc.misc.ProcessRunner
Direct Known Subclasses:
JavaCompile

public class ProcessRunner
extends Object

Run a process, optionally collecting stdout/stderr.


Field Summary
static int COLLECT_STDERR
           
static int COLLECT_STDOUT
           
static int DUMP_STDERR_ON_FAIL
           
(package private)  int exitCode
          Exit code of last process.
static int NO_EXCEPTION_ON_ERR_EXIT
           
static int PASS_STDERR
           
static int PASS_STDOUT
          Options to enable passing or collecting of output.
static int STDERR_TO_REPORTER
           
 
Constructor Summary
ProcessRunner(int opts)
          Constructor.
 
Method Summary
 int getExitCode()
           
 int getOptions()
          Get the options
 String getStderr()
          Get accumulated stderr, or null if it was not collected.
 String getStdout()
          Get accumulated stdout, or null if it was not collected.
 void run(String[] cmd, ErrorReporter errorReporter, PrintWriter verboseOut, String failMsg)
          Run a process.
 void setOptions(int opts)
          Set the options
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PASS_STDOUT

public static final int PASS_STDOUT
Options to enable passing or collecting of output.

PASS_STDERR

public static final int PASS_STDERR

COLLECT_STDOUT

public static final int COLLECT_STDOUT

COLLECT_STDERR

public static final int COLLECT_STDERR

STDERR_TO_REPORTER

public static final int STDERR_TO_REPORTER

DUMP_STDERR_ON_FAIL

public static final int DUMP_STDERR_ON_FAIL

NO_EXCEPTION_ON_ERR_EXIT

public static final int NO_EXCEPTION_ON_ERR_EXIT

exitCode

int exitCode
Exit code of last process.
Constructor Detail

ProcessRunner

public ProcessRunner(int opts)
Constructor.
Method Detail

setOptions

public void setOptions(int opts)
Set the options

getOptions

public int getOptions()
Get the options

getExitCode

public int getExitCode()

run

public void run(String[] cmd,
                ErrorReporter errorReporter,
                PrintWriter verboseOut,
                String failMsg)
         throws XMLCException
Run a process. Stdout/stderr are optionally copied to the standard descriptors and/or collected.
Parameters:
cmd - Program to run and arguments.
verboseOut - Write verbose message to this file if not null.
failMsg - Message to use in exception if process fails.

getStdout

public String getStdout()
Get accumulated stdout, or null if it was not collected.

getStderr

public String getStderr()
Get accumulated stderr, or null if it was not collected.


Copyright © 1999-2002 enhydra.org (Mark Diekhans, David Li, Richard Kunze). All Rights reserved.