Forget about tty detection. It won't work in build tools.

This commit is contained in:
Daniel Rosenwasser 2015-11-02 14:48:28 -08:00
parent 654cbd9779
commit 40f10abe01
2 changed files with 6 additions and 9 deletions

View file

@ -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) => {

View file

@ -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<string> = {
[DiagnosticCategory.Warning]: yellowForegroundEscapeSequence,