蚂蚁EXEC任务:我怎样才能读取控制台输入的标准输入? [英] Ant exec task: How can I read input from console stdin?

查看:176
本文介绍了蚂蚁EXEC任务:我怎样才能读取控制台输入的标准输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有蚂蚁的调用 EXEC 的任务,需要接受来自控制台stdin的输入。不幸的是,我无法找到一个方法来做到这一点。该标准输入文件句柄似乎封闭在运行时控制台输入。

I have a call to Ant exec task that needs to accept input from console stdin. Unfortunately, I cannot find a way to do this. The stdin filehandle seems closed to console input at runtime.

这是可以指定使用输入属性输入 inputstring 。但是,我需要提示在控制台的用户输入。

It is possible to specify input using attributes input and inputstring. However, I need to prompt for user input at the console.

我怎样才能做到这一点?

How can I do this?

推荐答案

文档的任务:

请注意,你不能与互动
  分叉程序,只有这样,才能发送
  输入到它是经由输入和
  inputstring属性。还要注意的是
  由于蚂蚁1.6,任何尝试读取
  在分叉的程序输入会
  收到EOF(-1)。这是一个变化
  从蚂蚁1.5,在这样的尝试
  会阻止。

Note that you cannot interact with the forked program, the only way to send input to it is via the input and inputstring attributes. Also note that since Ant 1.6, any attempt to read input in the forked program will receive an EOF (-1). This is a change from Ant 1.5, where such an attempt would block.

您可以尝试使用输入任务来提示输入蚂蚁构建文件,并通过这些输入以exec的inputstring属性。我想不出在目前一个更好的选择的。

You could try to use the input-task to prompt for input in the ant-buildfile and pass these input with the inputstring-attribute of exec. I can't think of a better option at the moment.

这篇关于蚂蚁EXEC任务:我怎样才能读取控制台输入的标准输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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