There is a race condition in PumpStreamHandler. To reproduce execute a process using the ant API - the Execute class initialized with a LogStreamHandler instance. Put breakpoints at the beginning of PumpStreamHandler.stop() and LogOutputStream.processLine(). Make sure the process started with Execute.execute() outputs at least one line in the standard output and exits. Once you start debugging, the debugger will stop at both breakpoints - the process has exited and PumpStreamHandler.stop() is called, while the thread which handles the output has also stopped at the breakpoint in LogOutputStream.processLine(). At this point if you resume the first thread, flush() will be called on the output stream - this will call processLine(). Thus, two different threads will process the same line, duplicating it in the output. We are working on a build tool in Eclipse which start an Ant build script and then parses the output. Because of this race condition we can't get a reliable output of a spawned process. Also this problem is not present in Ant 1.7.1.
since svn revision 1095736 flush() no longer calls processLine in order to fix bug 50507 This should also fix the race condition you describe. Can you please confirm trunk works for you?