Stepan Mishura wrote:
On 11/28/07, Agarkar, M (Milind) <[EMAIL PROTECTED]> wrote:
Thanks Jan.
Any idea about how to trap a PID on-the-fly ? It would be a script to run
automatically.
In snapshot testing we use the next targets to find and kill hung VMs
after a suite run.
that's cute. I'd probably just use killall, though its important to get
that pattern right or bad things happen
For ant1.8 I've been putting together a functional test task, <funtest>
that starts something in one thread, provided a condition to block a
test thread, runs the tests and then finally some teardown/reporting
tasks. This may make the problem you are trying to solve easier
<target name="clear-processes"
if="need.processes.cleanup"
depends="-init-clear-processes">
<echo>PROCESSES: ${proccess}</echo>
<exec executable="kill">
<arg line="${proccess}" />
</exec>
</target>
<target name="-init-clear-processes" unless="is.windows">
<exec executable="ps">
<arg value="a" />
<redirector outputproperty="proccess">
<outputfilterchain>
<!-- select only snapshot vm -->
<linecontainsregexp>
<regexp pattern="\s${jvm.location}\s" />
</linecontainsregexp>
<!-- get processes pids -->
<tokenfilter>
<replaceregex pattern="^\s*(\d+).*" replace="\1 " />
</tokenfilter>
<striplinebreaks />
</outputfilterchain>
</redirector>
</exec>
<condition property="need.processes.cleanup">
<and>
<istrue value="${do.processes.cleanup}" />
<length string="${proccess}"
trim="true"
when="greater"
length="0" />
</and>
</condition>
</target>
--
Steve Loughran http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]