DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24877>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24877 exec task doesn't handle error conditions well ------- Additional Comments From [EMAIL PROTECTED] 2003-11-21 11:53 ------- Opps I did a send by accidient: One could extend ExecTask with an onerror nested element: <target name="init"> <bsh:beanshelldef name="exec2" classname="Exec2"> import org.apache.tools.ant.taskdefs.condition.Condition; import org.apache.tools.ant.taskdefs.ExecTask; import org.apache.tools.ant.taskdefs.Sequential; public class Exec2 extends ExecTask implements Condition { private boolean runOk = false; private Sequential onError; protected void maybeSetResultPropertyValue(int result) { super.maybeSetResultPropertyValue(result); runOk = (result == 0); } public void addOnError(Sequential onError) { this.onError = onError; } public boolean eval() { execute(); return runOk; } public void execute() { super.execute(); if (!runOk && onError != null) { onError.perform(); } } } </bsh:beanshelldef> </target> and use it like so: <target name="onerror" depends="init"> <exec2 executable="sh" errorproperty="sh.error.output" failonerror="false"> <arg value="error.sh"/> <onError> <echo>exec failed with error output: ${sh.error.output}</echo> </onError> </exec2> </target> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]