Browse Source

Remove pre java 1.3 construct.

Remove spawn from Execute (spawn from ExecTask is actually used, the one here was never used)

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@768513 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 16 years ago
parent
commit
de5ed88e5e
2 changed files with 7 additions and 24 deletions
  1. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  2. +7
    -23
      src/main/org/apache/tools/ant/taskdefs/Execute.java

+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/ExecTask.java View File

@@ -607,7 +607,6 @@ public class ExecTask extends Task {
exe.setAntRun(getProject());
exe.setWorkingDirectory(dir);
exe.setVMLauncher(vmLauncher);
exe.setSpawn(spawn);
String[] environment = env.getVariables();
if (environment != null) {
for (int i = 0; i < environment.length; i++) {


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

@@ -26,8 +26,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Vector;
@@ -66,9 +64,6 @@ public class Execute {
private File workingDirectory = null;
private Project project = null;
private boolean newEnvironment = false;
//TODO: nothing appears to read this but is set using a public setter.
private boolean spawn = false;


/** Controls whether the VM is used to launch commands, where possible. */
private boolean useVMLauncher = true;
@@ -140,11 +135,14 @@ public class Execute {
*
* @param spawn if true you do not want Ant
* to wait for the end of the process.
* Has no influence in here, the calling task contains
* and acts accordingly
*
* @since Ant 1.6
* @deprecated
*/
public void setSpawn(boolean spawn) {
this.spawn = spawn;
// Method did not do anything to begin with
}

/**
@@ -528,6 +526,7 @@ public class Execute {
}
OutputStream dummyOut = new OutputStream() {
public void write(int b) throws IOException {
// Method intended to swallow whatever comes at it
}
};

@@ -802,13 +801,9 @@ public class Execute {
* Runtime.exec() command.
*/
private static class Java13CommandLauncher extends CommandLauncher {
private Method myExecWithCWD;

public Java13CommandLauncher() throws NoSuchMethodException {
// Locate method Runtime.exec(String[] cmdarray,
// String[] envp, File dir)
myExecWithCWD = Runtime.class.getMethod("exec",
new Class[] {String[].class, String[].class, File.class});
// Used to verify if Java13 is available, is prerequisite in ant 1.8
}

/**
@@ -829,18 +824,7 @@ public class Execute {
project.log("Execute:Java13CommandLauncher: "
+ Commandline.describeCommand(cmd), Project.MSG_DEBUG);
}
return (Process) myExecWithCWD.invoke(Runtime.getRuntime(),
/* the arguments: */ new Object[] {cmd, env, workingDir});
} catch (InvocationTargetException exc) {
Throwable realexc = exc.getTargetException();
if (realexc instanceof ThreadDeath) {
throw (ThreadDeath) realexc;
} else if (realexc instanceof IOException) {
throw (IOException) realexc;
} else {
throw new BuildException("Unable to execute command",
realexc);
}
return Runtime.getRuntime().exec(cmd, env, workingDir);
} catch (Exception exc) {
// IllegalAccess, IllegalArgument, ClassCast
throw new BuildException("Unable to execute command", exc);


Loading…
Cancel
Save