如何给exec在新的提示使用ant命令 [英] how to exec command in new prompt using ant

查看:174
本文介绍了如何给exec在新的提示使用ant命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在蚂蚁运行一个命令来启动Selenium服务器,但在相同的命令提示符打开了,反正是有,我可以在一个新的提示打开它?

 <项目>
<目标名称=startGRID>
    < EXEC DIR =。可执行=CMD>
        < ARG值=/ C/>
        < ARG值=Java的罐子硒的服务器独立-2.43.1.jar -role枢纽/>
    < / EXEC>
< /目标与GT;
< /项目>


解决方案

要在其中看到您的服务器运行一个单独的命令提示符下,使用DOS 启动命令,该命令究竟是:

 < EXEC DIR =。可执行=CMD>
  < ARG值=/ C/>
  < ARG值=开始/>
  < ARG值=Java的罐子硒的服务器独立-2.43.1.jar -role枢纽/>
< / EXEC>

我找到那个唯一的问题是,当服务器被终止,新的命令提示符窗口将继续开放。这可以通过批处理脚本包java命令被合作周围,让我们称之为启动selenium.bat,与退出结尾语句:

  Java的罐子硒的服务器独立-2.43.1.jar -role枢纽
出口

那么Ant任务就变成了:

 < EXEC DIR =。可执行=CMD>
  < ARG值=/ C/>
  < ARG值=开始/>
  < ARG值=启动selenium.bat/>
< / EXEC>

I am trying to run a command in ant to start the selenium server but it opens up in the same command prompt, is there anyway i can open it up in a new prompt?

<project>
<target name="startGRID">
    <exec dir="." executable="cmd">
        <arg value="/c"/>
        <arg value="java -jar selenium-server-standalone-2.43.1.jar -role hub"/>
    </exec>
</target>
</project>

解决方案

To see a separate command prompt in which your server is run, use the dos start command, which does exactly that:

<exec dir="." executable="cmd">
  <arg value="/c"/>
  <arg value="start"/>
  <arg value="java -jar selenium-server-standalone-2.43.1.jar -role hub"/>
</exec>

The only issue I find with that is that, when the server is terminated, the new command prompt window will remain open. This can be worked around by wrapping the java command in a batch script, let's call it start-selenium.bat, with an exit statement at the end:

java -jar selenium-server-standalone-2.43.1.jar -role hub
exit

then the Ant task becomes:

<exec dir="." executable="cmd">
  <arg value="/c"/>
  <arg value="start"/>
  <arg value="start-selenium.bat"/>
</exec>

这篇关于如何给exec在新的提示使用ant命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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