I'd also like to get your thoughts (and others) on an effective way to stop a non-forked Java program or a task from causing Ant to exit.
If the caller has (1) set a security manager that allows exit but disallows SM replacement, and (2) is using Main instead of Project, then there is not a lot we can do--but I don't have much sympathy for such clients. :-)
It seems that we could handle most other cases by:
a. Only instantiate an SM at all if some flag is set. That way the only people who have to deal with this weirdness are those fighting with ill-behaved tasks.
b. If (flag set) and (version > 1.1) install our SM.
c. SM delegates calls to the previous SM if any, except for checkExit.
d. Instead of always throwing SecurityException, allow the client to control which exception is thrown by setting some flag. This is a gross hack based on the assumption that different ill-behaved programs might eat different exceptions.
That still wouldn't be enough for all situations. I'd like to hear more from Peter about known problems.
Cheers, Stu