stevel 01/11/27 15:45:49
Modified: src/main/org/apache/tools/ant/taskdefs ExecTask.java
Log:
PR 5025 : Execute still fails when failonerror=false and the error is program
not found
I've decoupled the handler for this from failonerror to maximise backwards
compatibility, there is now a failIfExecuteFails flag, set to true by default.
Revision Changes Path
1.20 +9 -1
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
Index: ExecTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ExecTask.java 2001/11/27 19:25:44 1.19
+++ ExecTask.java 2001/11/27 23:45:49 1.20
@@ -93,6 +93,7 @@
private ByteArrayOutputStream baos = null;
private String outputprop;
private String resultProperty;
+ private boolean failIfExecFails=true;
/** Controls whether the VM (1.3 and above) is used to execute the
command */
private boolean vmLauncher = true;
@@ -200,6 +201,13 @@
}
/**
+ * ant attribute
+ */
+ public void setFailIfExecutionFails(boolean flag) {
+ failIfExecFails=flag;
+ }
+
+ /**
* Do the work.
*/
public void execute() throws BuildException {
@@ -310,7 +318,7 @@
try {
runExecute(exe);
} catch (IOException e) {
- if (failOnError) {
+ if (failIfExecFails) {
throw new BuildException("Execute failed: ",e, location);
} else {
log("Execute failed: "+e.toString(), Project.MSG_ERR);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>