Ant exec 任务 : How can I read input from console stdin?

标签 ant console exec stdin

我有一个电话给 Ant exec需要接受来自控制台标准输入的输入的任务。不幸的是,我找不到办法做到这一点。 stdin 文件句柄在运行时似乎对控制台输入关闭。

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

我怎样才能做到这一点?

最佳答案

来自 documentation任务:

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.



您可以尝试使用 input-task提示在 ant-buildfile 中输入并使用 exec 的 inputstring-attribute 传递这些输入。我暂时想不出更好的选择。

关于Ant exec 任务 : How can I read input from console stdin?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4176305/

相关文章:

c - Fork-exec 管道重定向问题

c - 在 C 中将 const char 参数传递给 static char *argv[] 的语法

c# - 使用 C# 程序自动完成 HTML 表单

c - 从输入中获取数字的最佳方式?

javascript - 在 Node-RED 中哪里可以找到控制台

python - 从 Python 中的字符串列表处理函数

grails - grails中使用了哪个构建工具?

java - 捆绑的可执行 jar 文件 - 找不到主类

Ant 到 Maven - 多个构建目标

java - 项目可交付成果中的 .classpath 文件