Browse Source

Restart stream reading and writing for each execution in <apply>.

PR: 22446


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275263 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
2bd38f0df1
2 changed files with 23 additions and 2 deletions
  1. +7
    -1
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  2. +16
    -1
      src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java

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

@@ -348,10 +348,16 @@ public class Execute {
*/
public Execute(ExecuteStreamHandler streamHandler,
ExecuteWatchdog watchdog) {
this.streamHandler = streamHandler;
setStreamHandler(streamHandler);
this.watchdog = watchdog;
}

/**
* @since Ant 1.6
*/
public void setStreamHandler(ExecuteStreamHandler streamHandler) {
this.streamHandler = streamHandler;
}

/**
* Returns the commandline used to create a subprocess.


+ 16
- 1
src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java View File

@@ -333,6 +333,11 @@ public class ExecuteOn extends ExecTask {
log(Commandline.describeCommand(command),
Project.MSG_VERBOSE);
exe.setCommandline(command);
if (haveExecuted) {
// need to reset the stream handler to restart
// reading of pipes
exe.setStreamHandler(createHandler());
}
runExecute(exe);
haveExecuted = true;
}
@@ -376,6 +381,11 @@ public class ExecuteOn extends ExecTask {
log(Commandline.describeCommand(command),
Project.MSG_VERBOSE);
exe.setCommandline(command);
if (haveExecuted) {
// need to reset the stream handler to restart
// reading of pipes
exe.setStreamHandler(createHandler());
}
runExecute(exe);
haveExecuted = true;
}
@@ -595,6 +605,11 @@ public class ExecuteOn extends ExecTask {
String[] command = getCommandline(cs, cb);
log(Commandline.describeCommand(command), Project.MSG_VERBOSE);
exe.setCommandline(command);
if (currentOffset > 0) {
// need to reset the stream handler to restart
// reading of pipes
exe.setStreamHandler(createHandler());
}
runExecute(exe);

stillToDo -= currentAmount;
@@ -615,4 +630,4 @@ public class ExecuteOn extends ExecTask {
return new String[] {"file", "dir", "both"};
}
}
}
}

Loading…
Cancel
Save