开发者

How can I apply a timeout to an Ant task?

开发者 https://www.devze.com 2022-12-23 10:08 出处:网络
Without writing a custom Ant task, is there a way to use a timeout on a regular ant target? To give some bac开发者_如何学运维kground info: we are using the \'delete\' task to remove the contents of a

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

To give some bac开发者_如何学运维kground 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.


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>


You can also use the limit task.

<target name="my-target">
  <limit seconds="2" failonerror="true">
    <sshexec ... />
  </limit>
</target>
0

精彩评论

暂无评论...
验证码 换一张
取 消