diff --git a/lib/launcher.js b/lib/launcher.js index a33d153..74a071a 100644 --- a/lib/launcher.js +++ b/lib/launcher.js @@ -318,16 +318,23 @@ TaskReporter_.prototype.log_ = function(data) { tag += (' #' + this.task.taskId); tag += '] '; - data = data.toString(); for ( var i = 0; i < data.length; i++ ) { if (this.insertTag) { this.insertTag = false; + // This ensures that the '\x1B[0m' appears before the tag, so that + // data remains correct when color is not processed. + // See https://github.com/angular/protractor/pull/1216 + if (data[i] === '\x1B' && data.substring(i, i+4) === '\x1B[0m' ) { + this.buffer += ('\x1B[0m' + tag); + i += 3; + continue; + } + this.buffer += tag; } if (data[i] === '\n') { this.insertTag = true; - this.buffer += '\x1B[0m'; // Prevent color from leaking into next line } this.buffer += data[i]; }