Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I apply a timeout to an Ant task?

Tags:

timeout

ant

Without writing a custom Ant task, is there a way to use a timeout on a regular ant target?

To give some background info: we are using the 'delete' task to remove the contents of a given directory. Sometimes this directory is massive, with lots of generated folders and files. We wanted to have that task timeout after, say, 5 minutes.

like image 250
Christopher Dancy Avatar asked Mar 17 '10 15:03

Christopher Dancy


2 Answers

You might use the parallel task, which has a timeout, with a parallel degree of one:

<target name="timed_del">
    <parallel threadCount="1" timeout="300000">
        <sequential>
            ... your tasks here ...
        </sequential>
    </parallel>
</target>
like image 84
martin clayton Avatar answered Sep 28 '22 20:09

martin clayton


You can also use the limit task.

<target name="my-target">
  <limit seconds="2" failonerror="true">
    <sshexec ... />
  </limit>
</target>
like image 37
HyunWoo Jo Avatar answered Sep 28 '22 18:09

HyunWoo Jo