DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26852>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26852

Exec task blocks when spawned





------- Additional Comments From [EMAIL PROTECTED]  2004-02-19 15:06 -------
OK, here comes the demo for Linux/Unix:

run the following build file:
<project name="test" default="test">
  <target name="test">
    <exec executable="sh" spawn="true">
      <arg value="-c"/>
      <arg value="echo do not forget to kill $$$$ > out.txt; while true; do echo
-n 1234567890 | tee -a out.txt; done"/>
    </exec>
    <input message="done?"/>
  </target>
</project>

It's no real world example, but it demonstrates the problem. It spawns a shell
process which (simulates a server process and) echos a string to stdout an into
out.txt in an endless loop. So out.txt should grow forever since a string is
appended in an endless loop in background. Then the build file asks you for
input to block the ant process. If you do an 'tail -f out.txt' on another xterm
you should see that the file stops growing after a while. This is when the
stdout buffer is full and the spawned process is blocked because of that. Now
press enter in the Ant's xterm. Ant exits and the JVM closes the spawned
process's stdout stream. Having a look at out.txt, you see it starts growing 
again.
Now you should kill the shell process...
Using my proposed patch, the spawned process won't block and out.txt grows
continously.

Actually my patch is too complicated. It should be sufficient to close the
spawned process's stdout, stdin and stderr streams.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to