Browse Source

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.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270036 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 23 years ago
parent
commit
daa1b619a1
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java

+ 9
- 1
src/main/org/apache/tools/ant/taskdefs/ExecTask.java View File

@@ -93,6 +93,7 @@ public class ExecTask extends Task {
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;
@@ -199,6 +200,13 @@ public class ExecTask extends Task {
}
}
/**
* ant attribute
*/
public void setFailIfExecutionFails(boolean flag) {
failIfExecFails=flag;
}
/**
* Do the work.
*/
@@ -310,7 +318,7 @@ public class ExecTask extends Task {
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);


Loading…
Cancel
Save