ProcessTask
Wednesday, November 13, 2002
Description
Allows a script to manage a process previously spawned by BackgroundExecTask (or descendant).
Parameters
Attribute |
Description |
Required |
refid |
The reference to the task or process manager for the spawned process. |
Yes |
waitfor |
Cause executing thread to wait for process termination |
No, defaults to false |
waitfortimeout |
Only used in conjunction with waitFor attribute (waitFor must be true). Causes executing thread to wait specified milliseconds for process termination. If zero specified, wait will be indefinite. |
No, defaults to zero |
destroy |
Destroys process. |
No, defaults to false |
destroytimeout |
Only used in conjunction with destroy attribute (destroy must be true). Causes executing thread to destroy process and then wait specified milliseconds for process to completely terminate. If zero specified, no wait will occur. |
No, defaults to zero |
resultproperty |
If process has exited, define this property to have a value of the process's exit value. Hint, easy way to tell if process is alive or not: If property defined, process has terminated, else process is alive (i.e. <fail if="result.property" message="Process exited prematurely"/>) |
No, defaults to working directory |
failonerror |
If process has exited and exit value not equal to zero, fail build. |
No, default to false |
Example
<taskdef name="rmid" classname="com.eatrmi.tools.ant.taskdefs.rmi.RmidTask"/>
<taskdef name="proc" classname="com.eatrmi.tools.ant.taskdefs.process.ProcessTask"/>
<rmid id="rmid" port="16000" security="mysecurity.policy"/>
<proc refid="rmid" resultproperty="rmid.result"/>
<fail if="rmid.result" message="Activation system died prematurely"/>
<proc waitfor="true" waitfortimeout="60000" destroy="true" resultproperty="rmid.result"/>
Starts the activation system on port 16000 using the RmidTask. Then, later, checks to see if rmid is still alive using the process task and fails if it's not. Finally, destroys the activation system after waiting specified milliseconds for normal process termination.