Ant exec: redirecting standard out but not standard error

喜夏-厌秋 提交于 2019-12-23 07:58:03

问题


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.


回答1:


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

See http://ant.apache.org/manual/Tasks/exec.html



来源:https://stackoverflow.com/questions/8607536/ant-exec-redirecting-standard-out-but-not-standard-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!