void (final String text, final Key outputType) { final int textLength = text.length(); synchronized (myStdOutChunks) { myStdOutChunks.add(new OutputChunk(outputType, text)); } final char lastChar = text.charAt(textLength - 1); if (lastChar == '\n' || lastChar == '\r') { // buffer contains consistent string flushStdOutBuffer(); } else { // test framework may show some promt and ask user for smth. Question may not // finish with \n or \r thus buffer wont be flushed and user will have to input smth // before question. And question will became visible with next portion of text. // Such behaviour is confusing. So // 1. Let's assume that sevice messages starts with \n if console is editable // 2. Then we can suggest that each service message will start from new line and buffer should // be flushed before every service message. Thus if chunks list is empty and output doesn't end // with \n or \r but starts with ##teamcity then it is a service message and should be buffered otherwise // we can safely flush buffer. // TODO if editable: if (myStdinSupportEnabled && !isInTeamcityMessage()) { // We should not flush in the middle of TC message because of [PY-7659] flushStdOutBuffer(); } } }