Browse Source

#31928: stop a forked process if the thread running <java> is stopped.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278066 13f79535-47bb-0310-9956-ffa450edef68
master
Jesse N. Glick 20 years ago
parent
commit
94b7b6cd05
2 changed files with 7 additions and 4 deletions
  1. +3
    -0
      WHATSNEW
  2. +4
    -4
      src/main/org/apache/tools/ant/taskdefs/Execute.java

+ 3
- 0
WHATSNEW View File

@@ -317,6 +317,9 @@ Other changes:
Fixed bugs: 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 * Programs run with <java fork="true"> can now accept standard input
from the Ant console. (Programs run with <java fork="false"> could from the Ant console. (Programs run with <java fork="false"> could
already do so.) Bugzilla 24918. already do so.) Bugzilla 24918.


+ 4
- 4
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -27,11 +27,8 @@ import java.io.PrintWriter;
import java.io.StringReader; import java.io.StringReader;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Vector; import java.util.Vector;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@@ -40,7 +37,6 @@ import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.condition.Os; import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.JavaEnvUtils;


/** /**
* Runs an external program. * Runs an external program.
@@ -485,6 +481,10 @@ public class Execute {
watchdog.checkException(); watchdog.checkException();
} }
return getExitValue(); return getExitValue();
} catch (ThreadDeath t) {
// #31928: forcibly kill it before continuing.
process.destroy();
throw t;
} finally { } finally {
// remove the process to the list of those to destroy if // remove the process to the list of those to destroy if
// the VM exits // the VM exits


Loading…
Cancel
Save