From daa1b619a133241ca541f124fa71acc1cadf0726 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 27 Nov 2001 23:45:49 +0000 Subject: [PATCH] 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 --- src/main/org/apache/tools/ant/taskdefs/ExecTask.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index 4df75d96f..c2625c964 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -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);