List<SmartOutputHandler.Consumer> errorConsumers = new LinkedList<>();
errorConsumers.add(new BuildErrorConsumer());
errorConsumers.addAll(consumers);
errorConsumers.add(new FileLineConsumer());
Writer forwardedStdOut = new LineOutputWriter(new SmartOutputHandler(
tab.getIo().getOutRef(),
Arrays.asList(taskDef.getStdOutListener(project)),
outputConsumers));
Writer forwardedStdErr = new LineOutputWriter(new SmartOutputHandler(
tab.getIo().getErrRef(),
Arrays.asList(taskDef.getStdErrListener(project)),
errorConsumers));
buildLauncher.setStandardOutput(new WriterOutputStream(forwardedStdOut));