Modify ↓
Ticket #450 (closed enhancement: invalid)
ForeachTask checkreturn param would be helpful
| Reported by: | FaZend <team@…> | Owned by: | mrook |
|---|---|---|---|
| Priority: | major | Milestone: | 2.4.1 |
| Component: | phing-core | Version: | 2.4.0 |
| Keywords: | Cc: |
Description
In ForeachTask checkreturn param would be helpful. For example:
<target name="zca" description="Zend Code Analyzer">
<foreach target="zca-file" param="fileName" absparam="zca.fileName">
<fileset dir="${project.basedir}">
<include name="**/*.php" />
<exclude name=".svn/**" />
</fileset>
</foreach>
</target>
<target name="zca-file" description="Zend Code Analyzer of one file">
<exec command="zca ${zca.fileName}"
escape="false"
checkreturn="true"
passthru="true" />
</target>
In such an example errors returned by ZCA on each file (zca-file) are just ignored by the parent task (zca). Would be great to have it like this:
<target name="zca" description="Zend Code Analyzer">
<foreach target="zca-file" param="fileName"
absparam="zca.fileName" checkreturn="true">
<fileset dir="${project.basedir}">
<include name="**/*.php" />
<exclude name=".svn/**" />
</fileset>
</foreach>
</target>
Attachments
Change History
comment:2 Changed 2 years ago by mrook
- Status changed from new to assigned
Introducing it as default behavior can interfere with backwards compatibility.
comment:3 Changed 2 years ago by mrook
Could you explain what you mean by "errors returned ... are just ignored by the parent task" ?
With the following snippet:
<target name="test">
<foreach target="test-file">
<fileset dir="test">
<include name="**/*.php" />
<exclude name=".svn/**" />
</fileset>
</foreach>
</target>
<target name="test-file">
<exec command="exit 1" checkreturn="true"/>
</target>
the results are as expected:
Execution of target "test-file" failed for the following reason: /dev/phing_tests/450/build.xml:14:28: Task exited with code 1 [foreach] /dev/phing_tests/450/build.xml:14:28: Task exited with code 1 Execution of target "test" failed for the following reason: /dev/phing_tests/450/build.xml:5:39: Execution of the target buildfile failed. Aborting.
Note: See
TracTickets for help on using
tickets.

btw, maybe this behavior should be a default one?...