You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by John Mazzitelli <ma...@gmail.com> on 2009/02/03 07:15:00 UTC

exec and the input hanging problem again

I am hitting the bug where Ant hangs when doing an <exec> - see bug: 
https://issues.apache.org/bugzilla/show_bug.cgi?id=34461

I can't seem to get the workaround of using inputstring to work. I can 
replicate this bug, even when using inputstring="", on both Ant 1.6.5 
and Ant 1.7.1 - and I've seen this on both solaris and linux.

It's really simple to replicate - I'd appreciate it if someone can give 
me an idiot lesson on what I'm doing wrong, or tell me if I should 
submit another bug report on this.

1) Put the following three files in a directory (runjava.sh,  build.xml 
and Test.java - see below).
2) Compile Test.java via "javac Test.java".
3) Finally, just run "ant".

The ant script should complete very fast because runjava.sh puts the 
Java VM in background via "&". However, ant just hangs and will only die 
when the Java VM dies (which will be after a sleep of 60 seconds):

---runjava.sh---
java Test 60000 &

---build.xml---
<project name="test" default="do">
   <target name="do">
      <echo>Executing - this should go fast...</echo>
      <exec dir="." inputstring="" executable="/bin/sh">
        <arg line="runjava.sh"/>
      </exec>
      <echo>Execute finished.</echo>
   </target>
</project>

---Test.java---
public class Test {
   public static void main(String[] args) throws Exception {
      System.out.println("Java: sleeping");
      Thread.sleep(Long.parseLong(args[0]));
      System.out.println("Java: done sleeping");
   }
}




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