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 Summary: exec task doesn't handle error conditions well Product: Ant Version: 1.6Beta Platform: All OS/Version: Linux Status: NEW Severity: Normal Priority: Other Component: Core tasks AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Using the exec core task, if I set the attribute failonerror to true, ant will exit if the executed sub-program returns an error code. That part is fine. The error message displayed does not include anything the sub-program displayed on the error stream. I get: "/home/esafern/depot/ContentDev/BuildTools/build.xml:868: exec returned: 2" - not the most useful of error messages. This, I could argue, is a bug right here - it is an error stream, after all. But, OK, I should be able to override this behavior as follows: <exec executable="perl" failonerror="no" errorproperty="errorText"> <arg line="prog.pl" /> </exec> <antcall target="failOnError" /> <!-- failOnError: exit if the errorText property is set --> <target name="failOnError" if="errorText"> <fail message="Error: an executed program has returned the following error: '${errorText}'. Please contact your site administrator for further help." /> </target> <!-- failOnError --> However, this doesn't work - the failOnError target is always called. Why? Because the exec task sets the errorText property, even if the subprogram produces no output on the error stream! I believe it shouldn't do that. The same logic applies to the outputproperty (which I haven't tested) - then I can take action depending on whether or not the subprogram produced output. I realize I could build a condition around <not> <equals arg1=${errorText} arg2=""></not> - but this seems overly complex. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]