windows - ANT 构建脚本如何终止 Windows 进程?

标签 windows ant command-line build

我正在努力扩展 ANT 构建脚本以允许 TeamCity 构建代理运行 Selenium 测试。

在这样做时,需要一个服务器以 selenium 启动,该服务器最后不会关闭。所以我添加了一个额外的目标来在每个 TC 构建结束时对 exe 名称执行 taskkill。

taskkill 是否需要 exe 的绝对路径,因为以下不起作用;

<target name="shutdown.server" depends="init.properties" description="Shutdown the server after Selenium">
    <exec osfamily="windows" executable="cmd.exe" spawn="true">
        <arg line="taskkill /f /t /im app.exe"/>
    </exec>
</target>

这个过程似乎有几个 child ,这就是为什么我选择 /f/t 但正如我所说,目前没有一个 child 关闭。

最佳答案

好吧,这很简单;

<target name="shutdown.server" depends="init.properties" description="Shutdown the server after Selenium">
    <exec executable="taskkill">
        <arg line="/im app.exe /f /t"/>
    </exec>
</target>

关于windows - ANT 构建脚本如何终止 Windows 进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15518492/

相关文章:

windows - 如何使用系统 (Windows) 从 Perl 调用子目录中的脚本

command-line - sbt 如何在多个可执行文件时传递命令行参数

java - JUnit 测试在 Ant 中失败,任务为 `<junit>`,但通过 `<exec>` 任务?

batch-file - 如何添加右键单击选项以使用所选文件的名称搜索网络?

shell - 在 shell 脚本中合并两个输出

c - Win VS2008 调用约定 : Delphi dll from c

C++:将控制台窗口设置为 WS_POPUP

windows - 为什么对话框会在不刷新的情况下删除其内容?

java - 从java代码运行时如何将参数传递给ant脚本?

java - 使用即时版本的 <gunzip> Ant 任务的 NullPointerException