Modify

Ticket #450 (closed enhancement: invalid)

Opened 2 years ago

Last modified 2 years ago

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:1 Changed 2 years ago by FaZend <team@…>

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

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.

comment:4 Changed 2 years ago by FaZend <team@…>

looks like it's a problem of ZCA, it doesn't return error code properly.

please, close the ticket. thanks.

comment:5 Changed 2 years ago by mrook

  • Status changed from assigned to closed
  • Resolution set to invalid
View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.