The Ant exec task has an output property which can be used to tell Ant where the output goes. I\'ve used it to redirect the output to a file. The thing is, if I
When executing a batch file with ant's apply or exec tasks on Windows, I found there are special cases where some of the stdout and stderr is not captured by ant. (For example: if you call a batch file that in turn calls other commands (like node.exe), then the stdout and stderror from the child node.exe process is lost.)
I spent a long time trying to debug this! It seems that the batch file's stdout and stderr is captured, however commands called by the batch file are somehow not seen by ant. (perhaps because they are separate child processes). Using the output and error attributes as suggested above doesn't help because only some of the stdout and/or stderr is captured.
The solution I came up with (a hack) is to add these arguments at the end of the command:
Because this hack only applies to windows, remember to add @osfamily="windows" to the apply or exec task. And create similar task(s) for `@osfamily="unix", etc but without these extra arguments.