It would be nice if ExecTask had an option to store the exit code of the executed program in a property so it can be used later on. This is especially useful when you need to call a program that doesn't strictly adhere to the convention of always returning 0 for a successfull run and you need to cancel the build if it failed, so you can't use the "checkreturn" attribute.
I think it would be consistent to use an attribute called "returnProperty" (like PhpEvalTask does) for this purpose.
A more elaborate solution would be to allow for two attributes, lets call them "fail" and "failnot" which take a list of return values on which to fail or not to fail.
Consider this example:
<exec cmd="someprogram -x -y -z" failnot="0,1" failmsg="Someprogram made a boo boo, aborting build" />
This snippet should fail if someprogram returns anything else than 0 or 1.
<exec cmd="someprogram -x -y -z" fail="99" failmsg="Someprogram made a severe boo boo, aborting build" />
This snippet would only fail if the someprogram returned 99.