|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.apache.tools.ant.taskdefs.Execute
Runs an external program.
| Field Summary | |
static int |
INVALID
Invalid exit code. |
| Constructor Summary | |
Execute()
Creates a new execute object using PumpStreamHandler for
stream handling. |
|
Execute(ExecuteStreamHandler streamHandler)
Creates a new execute object. |
|
Execute(ExecuteStreamHandler streamHandler,
ExecuteWatchdog watchdog)
Creates a new execute object. |
|
| Method Summary | |
int |
execute()
Runs a process defined by the command line and returns its exit status. |
java.lang.String[] |
getCommandline()
Returns the commandline used to create a subprocess. |
java.lang.String[] |
getEnvironment()
Returns the commandline used to create a subprocess. |
protected int |
getExitValue()
|
static void |
runCommand(Task task,
java.lang.String[] cmdline)
A utility method that runs an external command. |
void |
setAntRun(Project project)
Set the name of the antRun script using the project's value. |
void |
setCommandline(java.lang.String[] commandline)
Sets the commandline of the subprocess to launch. |
void |
setEnvironment(java.lang.String[] env)
Sets the environment variables for the subprocess to launch. |
protected void |
setExitValue(int value)
|
void |
setWorkingDirectory(java.io.File wd)
Sets the working directory of the process to execute. |
protected void |
waitFor(java.lang.Process process)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int INVALID
| Constructor Detail |
public Execute()
PumpStreamHandler for
stream handling.public Execute(ExecuteStreamHandler streamHandler)
streamHandler - the stream handler used to handle the input and
output streams of the subprocess.
public Execute(ExecuteStreamHandler streamHandler,
ExecuteWatchdog watchdog)
streamHandler - the stream handler used to handle the input and
output streams of the subprocess.watchdog - a watchdog for the subprocess or null to
to disable a timeout for the subprocess.| Method Detail |
public java.lang.String[] getCommandline()
public void setCommandline(java.lang.String[] commandline)
commandline - the commandline of the subprocess to launchpublic java.lang.String[] getEnvironment()
public void setEnvironment(java.lang.String[] env)
commandline - array of Strings, each element of which has
an environment variable settings in format key=valuepublic void setWorkingDirectory(java.io.File wd)
This is emulated using the antRun scripts unless the OS is Windows NT in which case a cmd.exe is spawned, or MRJ and setting user.dir works, or JDK 1.3 and there is official support in java.lang.Runtime.
wd - the working directory of the process.
public void setAntRun(Project project)
throws BuildException
project - the current project.
public int execute()
throws java.io.IOException
INVALIDjava.io.IOExcpetion - The exception is thrown, if launching
of the subprocess failedprotected void waitFor(java.lang.Process process)
protected void setExitValue(int value)
protected int getExitValue()
public static void runCommand(Task task,
java.lang.String[] cmdline)
throws BuildException
task - The task that the command is part of. Used for loggingcmdline - The command to execute.BuildException - if the command does not return 0.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||