use of org.apache.tools.ant.util.OutputStreamFunneler in project ant by apache.
the class Redirector method errorStreams.
private void errorStreams() {
if (error != null && error.length > 0) {
final String logHead = "Error " + ((appendErr) ? "appended" : "redirected") + " to ";
errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE, appendErr, createEmptyFilesErr);
} else if (!(logError || outputStream == null) && errorProperty == null) {
final long funnelTimeout = 0L;
final OutputStreamFunneler funneler = new OutputStreamFunneler(outputStream, funnelTimeout);
try {
outputStream = funneler.getFunnelInstance();
errorStream = funneler.getFunnelInstance();
if (!outputIsBinary) {
outputStream = new LineOrientedOutputStreamRedirector(outputStream);
errorStream = new LineOrientedOutputStreamRedirector(errorStream);
}
} catch (final IOException eyeOhEx) {
throw new BuildException("error splitting output/error streams", eyeOhEx);
}
}
if (errorProperty != null) {
if (errorBaos == null) {
errorBaos = new PropertyOutputStream(errorProperty);
managingTask.log("Error redirected to property: " + errorProperty, Project.MSG_VERBOSE);
}
// shield it from being closed by a filtering StreamPumper
final OutputStream keepAliveError = new KeepAliveOutputStream(errorBaos);
errorStream = (error == null || error.length == 0) ? keepAliveError : new TeeOutputStream(errorStream, keepAliveError);
} else {
errorBaos = null;
}
}
Aggregations