diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
index 56863c23c..67e918232 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
@@ -64,7 +64,7 @@ import java.io.IOException;
/**
* Executes a given command, supplying a set of files as arguments.
*
- * @author Stefan Bodewig
+ * @author Stefan Bodewig
* @author Mariusz Nowostawski
*/
public class ExecuteOn extends ExecTask {
@@ -72,6 +72,7 @@ public class ExecuteOn extends ExecTask {
protected Vector filesets = new Vector();
private boolean parallel = false;
protected String type = "file";
+ protected Commandline.Marker srcFilePos = null;
/**
* Adds a set of files (nested fileset attribute).
@@ -94,6 +95,19 @@ public class ExecuteOn extends ExecTask {
this.type = type.getValue();
}
+ /**
+ * Marker that indicates where the name of the source file should
+ * be put on the command line.
+ */
+ public Commandline.Marker createSrcfile() {
+ if (srcFilePos != null) {
+ throw new BuildException(taskType + " doesn\'t support multiple srcfile elements.",
+ location);
+ }
+ srcFilePos = cmdl.createMarker();
+ return srcFilePos;
+ }
+
protected void checkConfiguration() {
super.checkConfiguration();
if (filesets.size() == 0) {
@@ -128,11 +142,11 @@ public class ExecuteOn extends ExecTask {
v.copyInto(s);
int err = -1;
- String myos = System.getProperty("os.name");
if (parallel) {
- cmdl.addArguments(s);
- exe.setCommandline(cmdl.getCommandline());
+ String[] command = getCommandline(s);
+ log("Executing " + Commandline.toString(command), Project.MSG_VERBOSE);
+ exe.setCommandline(command);
err = exe.execute();
if (err != 0) {
if (failOnError) {
@@ -144,11 +158,10 @@ public class ExecuteOn extends ExecTask {
}
} else {
- String[] cmd = new String[cmdl.size()+1];
- System.arraycopy(cmdl.getCommandline(), 0, cmd, 0, cmdl.size());
for (int i=0; i
The name of the executable - if set - is counted as the + * very first argument.
+ */ + public int getPosition() { + if (realPos == -1) { + realPos = (executable == null ? 0 : 1); + for (int i=0; i