ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Mazzitelli <mazzg...@gmail.com>
Subject exec and the input hanging problem again
Date Tue, 03 Feb 2009 06:15:00 GMT
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


Mime
View raw message