git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@927753 13f79535-47bb-0310-9956-ffa450edef68master
@@ -107,6 +107,15 @@ Other changes: | |||||
used to manifest itself in unrelated errors like | used to manifest itself in unrelated errors like | ||||
Bugzilla Report 43586. | Bugzilla Report 43586. | ||||
* A change that made <exec> more reliable on Windows (Bugzilla Report | |||||
5003) strongly impacts the performance for commands that execute | |||||
quickly, like attrib. Basically no single execution of a command | |||||
could take less than a second on Windows. | |||||
A few timeouts have been tweaked to allow these commands to finish | |||||
more quickly but still they will take longer than they did with Ant | |||||
1.7.1. | |||||
Bugzilla Report 48734. | |||||
Changes from Ant 1.8.0RC1 TO Ant 1.8.0 | Changes from Ant 1.8.0RC1 TO Ant 1.8.0 | ||||
====================================== | ====================================== | ||||
@@ -148,7 +148,7 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
finish(errorThread); | finish(errorThread); | ||||
} | } | ||||
private static final long JOIN_TIMEOUT = 500; | |||||
private static final long JOIN_TIMEOUT = 200; | |||||
/** | /** | ||||
* Waits for a thread to finish while trying to make it finish | * Waits for a thread to finish while trying to make it finish | ||||
@@ -160,11 +160,18 @@ public class PumpStreamHandler implements ExecuteStreamHandler { | |||||
*/ | */ | ||||
protected final void finish(Thread t) { | protected final void finish(Thread t) { | ||||
try { | try { | ||||
t.join(JOIN_TIMEOUT); | |||||
StreamPumper s = null; | StreamPumper s = null; | ||||
if (t instanceof ThreadWithPumper) { | if (t instanceof ThreadWithPumper) { | ||||
s = ((ThreadWithPumper) t).getPumper(); | s = ((ThreadWithPumper) t).getPumper(); | ||||
} | } | ||||
if (s != null && s.isFinished()) { | |||||
return; | |||||
} | |||||
if (!t.isAlive()) { | |||||
return; | |||||
} | |||||
t.join(JOIN_TIMEOUT); | |||||
if (s != null && !s.isFinished()) { | if (s != null && !s.isFinished()) { | ||||
s.stop(); | s.stop(); | ||||
} | } | ||||
@@ -628,4 +628,41 @@ | |||||
</exec> | </exec> | ||||
</target> | </target> | ||||
<target name="testDoesntWaitForChildren" | |||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=5003"> | |||||
<mkdir dir="${input}/org/example"/> | |||||
<pathconvert dirsep="/" property="out"> | |||||
<path location="${output}"/> | |||||
</pathconvert> | |||||
<echo file="${input}/org/example/CallHello.java"><![CDATA[ | |||||
package org.example; | |||||
public class CallHello { | |||||
public static void main(String[] args) | |||||
throws Exception { | |||||
Runtime.getRuntime().exec("java -cp ${out} org.example.Hello"); | |||||
Thread.sleep(1 * 1000); | |||||
System.out.println("finished"); | |||||
} | |||||
}]]></echo> | |||||
<echo file="${input}/org/example/Hello.java"><![CDATA[ | |||||
package org.example; | |||||
public class Hello { | |||||
public static void main(String[] args) | |||||
throws Exception { | |||||
for (int i = 0; i < 20; ++i) { | |||||
System.out.println("Hello " + i); | |||||
System.out.flush(); | |||||
Thread.sleep(1 * 1000); | |||||
} | |||||
} | |||||
}]]></echo> | |||||
<mkdir dir="${output}"/> | |||||
<javac srcdir="${input}" destdir="${output}"/> | |||||
<exec executable="java"> | |||||
<arg line="-cp ${output} org.example.CallHello"/> | |||||
</exec> | |||||
<au:assertLogContains text="finished"/> | |||||
<au:assertLogDoesntContain text="Hello 20"/> | |||||
</target> | |||||
</project> | </project> |