Skip to content

Commit

Permalink
Forget about tty detection. It won't work in build tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielRosenwasser committed Nov 2, 2015
1 parent 654cbd9 commit 40f10ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -379,7 +378,6 @@ namespace ts {
write(s: string): void {
process.stdout.write(s);
},
writesToTty: () => _tty.isatty(1),
readFile,
writeFile,
watchFile: (fileName, callback) => {
Expand Down
13 changes: 6 additions & 7 deletions src/compiler/tsc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 40f10ab

Please sign in to comment.