ant_on_air: Exec task makes Ant fail if failonerror is true and the 
NativeProcessExitEvent exitCode is not 0


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/903fddec
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/903fddec
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/903fddec

Branch: refs/heads/feature/flash-downloader
Commit: 903fddecda2c30e6069db5763baec51dca5a82c7
Parents: 60b0452
Author: Josh Tynjala <joshtynj...@apache.org>
Authored: Mon Nov 21 14:35:44 2016 -0800
Committer: Josh Tynjala <joshtynj...@apache.org>
Committed: Mon Nov 21 14:35:44 2016 -0800

----------------------------------------------------------------------
 .../ant_on_air/src/org/apache/flex/ant/tags/Exec.as     | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/903fddec/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Exec.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Exec.as 
b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Exec.as
index bc503a6..e5eced7 100644
--- a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Exec.as
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Exec.as
@@ -126,11 +126,23 @@ package org.apache.flex.ant.tags
         {
             return getAttributeValue("@outputproperty");
         }
+
+        override public function get failonerror():Boolean
+        {
+            var val:String = getNullOrAttributeValue("@failonerror");
+            //if omitted, defaults to false
+            return val == null ? false : val == "true";
+        }
         
         private var process:NativeProcess;
         
         private function exitHandler(event:NativeProcessExitEvent):void
         {
+            if(event.exitCode !== 0 && failonerror)
+            {
+                ant.project.failureMessage = "Exec task failed: " + fileName;
+                ant.project.status = false;
+            }
             dispatchEvent(new Event(Event.COMPLETE));
         }
         

Reply via email to