jglick 2005/03/28 13:43:18
Modified: . WHATSNEW
src/main/org/apache/tools/ant/taskdefs Execute.java
Log:
#31928: stop a forked process if the thread running <java> is stopped.
Revision Changes Path
1.795 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.794
retrieving revision 1.795
diff -u -r1.794 -r1.795
--- WHATSNEW 25 Mar 2005 12:28:59 -0000 1.794
+++ WHATSNEW 28 Mar 2005 21:43:18 -0000 1.795
@@ -317,6 +317,9 @@
Fixed bugs:
-----------
+* Killing a thread running <java fork="true"> (e.g. from an IDE) would
+ not stop the forked process. Bugzilla 31928.
+
* Programs run with <java fork="true"> can now accept standard input
from the Ant console. (Programs run with <java fork="false"> could
already do so.) Bugzilla 24918.
1.94 +4 -4 ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -r1.93 -r1.94
--- Execute.java 10 Mar 2005 12:50:57 -0000 1.93
+++ Execute.java 28 Mar 2005 21:43:18 -0000 1.94
@@ -27,11 +27,8 @@
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
@@ -40,7 +37,6 @@
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.JavaEnvUtils;
/**
* Runs an external program.
@@ -485,6 +481,10 @@
watchdog.checkException();
}
return getExitValue();
+ } catch (ThreadDeath t) {
+ // #31928: forcibly kill it before continuing.
+ process.destroy();
+ throw t;
} finally {
// remove the process to the list of those to destroy if
// the VM exits
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]