void () { // if osColoredProcessHandler was attached it can split string with several colors // in several parts. Thus '\n' symbol may be send as one part with some color // such situation should differ from single '\n' from process that is used by TC reporters // to separate TC commands from other stuff + optimize flushing // TODO: probably in IDEA mode such runners shouldn't add explicit \n because we can // successfully process broken messages across several flushes // size of parts may tell us either \n was single in original flushed data or it was // separated by process handler List<OutputChunk> chunks = new ArrayList<>(); OutputChunk lastChunk = null; synchronized (myStdOutChunks) { for (OutputChunk chunk : myStdOutChunks) { if (lastChunk != null && chunk.getKey() == lastChunk.getKey()) { String chunkText = chunk.getText(); if (USE_CYCLE_BUFFER) { StringBuilder builder = lastChunk.myBuilder; if (builder != null && builder.length() + chunkText.length() > myCurrentCyclicBufferSize && myCurrentCyclicBufferSize > 2 * SM_MESSAGE_PREFIX) { builder.delete(SM_MESSAGE_PREFIX, Math.min(builder.length(), myCurrentCyclicBufferSize - SM_MESSAGE_PREFIX)); } } lastChunk.append(chunkText); } else { lastChunk = chunk; chunks.add(chunk); } } myStdOutChunks.clear(); } onChunksAvailable(chunks, chunks.size() == 1); }