ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28565] - org.apache.tools.ant.taskdefs.Execute
Date Mon, 26 Apr 2004 22:28:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28565>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28565

org.apache.tools.ant.taskdefs.Execute





------- Additional Comments From gudnabrsam@yahoo.com  2004-04-26 22:28 -------
After having gone to the trouble of locating a precompiled lsof executable 
because I couldn't get it to install, I still don't see what this example is 
attempting to prove.  My slightly modified version of your buildfile:

<project name="ShowBug" default="bug">

  <property name="ksh" value="/usr/bin/ksh" />
  <property name="lsof" value="/usr/local/bin/lsof" />

  <target name="pid">
    <echo file="getpid" >
      echo PPID=$PPID
    </echo>
    <exec executable="${ksh}" output="pidout" >
      <arg line="getpid " />
    </exec>
    <property file="pidout" />
    <echo message="I am process ${PPID}" />
  </target>

  <target name="lsofa" depends="pid">
    <!-- send these to output files for easy comparison -->
    <exec executable="${lsof}" output="lsofa">
      <arg line=" -p ${PPID}" />
    </exec>
  </target>

  <!-- in a real buildfile, having both targets depend on pid
       would be okay as long as they are not invoked separately from
       the commandline, in which case you'd get an insignificant warning -->

  <target name="lsofb" depends="pid">
    <exec executable="${lsof}" output="lsofb">
      <arg line=" -p ${PPID}" />
    </exec>
  </target>

  <target name="reproduce">
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
    <exec executable="/bin/true" />
  </target>

  <target name="bug" depends="lsofa,reproduce,lsofb" />

  <target name="clean">
    <delete>
      <fileset dir="${basedir}" includes="lsofa,lsofb" />
    </delete>
  </target>

</project>

When I save to showbug.xml and use the following command line:

ant -f showbug.xml && wc -l lsofa lsofb

wc tells me:

      75 lsofa
      75 lsofb
     150 total

So if the example is intended to show me that there are more files open after 
the reproduce target is called, I can't see that it does.  In the case of 
<exec> (ExecTask), its streams are closed when Redirector.complete() is 
called.  Inspection of AbstractCVSTask shows that its output and error streams 
(if not null) are closed in a finally block at the end of runCommand(), so this 
example also does not seem to hold water.

As you say, in most cases it would be fine to have the PumpStreamHandler's 
StreamPumpers automatically close their streams.  But as long as the job is 
done somewhere there should be no problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message