如何将超时应用于 Ant 任务? [英] How can I apply a timeout to an Ant task?

查看:27
本文介绍了如何将超时应用于 Ant 任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不编写自定义 Ant 任务,有没有办法在常规 ant 目标上使用超时?

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

提供一些背景信息:我们正在使用删除"任务来删除给定目录的内容.有时这个目录很大,有很多生成的文件夹和文件.我们希望该任务在 5 分钟后超时.

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.

推荐答案

您可以使用 并行任务,有超时,并行度为1:

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>

这篇关于如何将超时应用于 Ant 任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆