当我们使用带curl的ant运行action时,如何显示进度


How to display progress when we run action using ant with curl

我的示例代码是。

<target name="retrieve-userdata" depends="test-src">
    <echo message="start the process for fetch region and event"/>
    <exec executable="curl">            
        <arg value='http://localhost/magento/index.php/facebook/index/test' />
    </exec>
    <echo message="end the process for fetch region and event"/>
</target>

当我们运行这个ant时,这个

http://localhost/magento/index.php/facebook/index/test 

action是调用并执行该操作。其中,循环执行多次并获取用户facebook事件。

所以我们希望在这个动作中执行循环时在控制台中显示每个事件的名称。

请帮助我。

我认为你可以使用splash来显示进度。
查看下面的示例,希望对您有所帮助:

<target name="retrieve-userdata" depends="test-src">
     <splash progressRegExp="Progress: (.*)%" showduration="0" displayText="Test text"/>
     <echo>Progress: 10%</echo>
     <exec executable="cmd">
        <arg value="/c" />
        <arg value="c:'xampp'htdocs'magento'index.php" />
        <arg value=" facebook/index/test" />
    </exec>
     <echo>Progress: 50%</echo>
     <!-- task 2 -->
     <echo>Progress: 70%</echo>
     <!-- task n -->
     <echo>Progress: 100%</echo>
     <sleep seconds="2"/>
</target>

在你的文件中,把ob_implicit_flush(1);放在这一行,以便立即在控制台

中显示输出

如果您只想获取url, ant为它提供了一个特定的任务。得到

这也有使用点的反馈。

参见网站中的示例…

 <get src="http://www.apache.org/dist/ant/KEYS" 
    dest="KEYS" 
    verbose="true"
    usetimestamp="true"/>