Ant exec:重定向标准输出但不是标准错误 [英] Ant exec: redirecting standard out but not standard error

查看:32
本文介绍了Ant exec:重定向标准输出但不是标准错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 exec 任务,我使用 outputproperty 属性将其输出放入一个属性中.该命令可能会向 stderr 打印一些错误,我不希望将这些错误包含在输出中(因为输出被馈送到另一个命令中),而是要打印给用户.所以我将输出和错误重定向到单独的属性和 echo 错误属性.不得不 echo 错误似乎有点麻烦.是否可以重定向 exec 的输出但在 stderr 或 stdout 上留下错误?我认为这意味着将 error 属性设置为某个神奇的值,但我无法弄清楚该值是什么.

I have an exec task whose output I am putting into a property using the outputproperty attribute. The command may print some errors to stderr, I do not want the errors to be included in the output (since the output is being fed into another command) but rather to be printed out to the user. So I am redirecting the output and error into separate properties and echo the error property. It seems kind of a hack to have to echo the error. Is it possible to redirect the output of an exec but leave error on stderr or stdout? I assume it means setting the error attribute to some magical value but I cannot figure out what that value is.

推荐答案

尝试移除 errorerrorproperty 属性并添加 logError="true".

Try removing error or errorproperty attributes and adding logError="true".

参见http://ant.apache.org/manual/Tasks/exec.html

这篇关于Ant exec:重定向标准输出但不是标准错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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