From 40f10abe01b3765193c62f7eacb7e17e2f911cd7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 2 Nov 2015 14:48:28 -0800 Subject: [PATCH] Forget about tty detection. It won't work in build tools. --- src/compiler/sys.ts | 2 -- src/compiler/tsc.ts | 13 ++++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index ee9d1a9653c..6263f7237f6 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -6,7 +6,6 @@ namespace ts { newLine: string; useCaseSensitiveFileNames: boolean; write(s: string): void; - writesToTty?(): boolean; readFile(path: string, encoding?: string): string; writeFile(path: string, data: string, writeByteOrderMark?: boolean): void; watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher; @@ -379,7 +378,6 @@ namespace ts { write(s: string): void { process.stdout.write(s); }, - writesToTty: () => _tty.isatty(1), readFile, writeFile, watchFile: (fileName, callback) => { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 66a6cbb65bd..f996797db6e 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -104,13 +104,12 @@ namespace ts { sys.write(output); } - const shouldUseColors = !!sys.writesToTty && sys.writesToTty(); - const redForegroundEscapeSequence = shouldUseColors ? "\u001b[91m" : ""; - const yellowForegroundEscapeSequence = shouldUseColors ? "\u001b[93m" : ""; - const blueForegroundEscapeSequence = shouldUseColors ? "\u001b[93m" : ""; - const gutterStyleSequence = shouldUseColors ? "\u001b[100;30m" : ""; - const gutterSeparator = shouldUseColors ? " " : " | "; - const resetEscapeSequence = shouldUseColors ? "\u001b[0m" : ""; + const redForegroundEscapeSequence = "\u001b[91m"; + const yellowForegroundEscapeSequence = "\u001b[93m"; + const blueForegroundEscapeSequence = "\u001b[93m"; + const gutterStyleSequence = "\u001b[100;30m"; + const gutterSeparator = " "; + const resetEscapeSequence = "\u001b[0m"; const elipsis = "..."; const categoryFormatMap: Map = { [DiagnosticCategory.Warning]: yellowForegroundEscapeSequence,