Skip to content

Commit 40f10ab

Browse files
Forget about tty detection. It won't work in build tools.
1 parent 654cbd9 commit 40f10ab

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/compiler/sys.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace ts {
66
newLine: string;
77
useCaseSensitiveFileNames: boolean;
88
write(s: string): void;
9-
writesToTty?(): boolean;
109
readFile(path: string, encoding?: string): string;
1110
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
1211
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
@@ -379,7 +378,6 @@ namespace ts {
379378
write(s: string): void {
380379
process.stdout.write(s);
381380
},
382-
writesToTty: () => _tty.isatty(1),
383381
readFile,
384382
writeFile,
385383
watchFile: (fileName, callback) => {

src/compiler/tsc.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,12 @@ namespace ts {
104104
sys.write(output);
105105
}
106106

107-
const shouldUseColors = !!sys.writesToTty && sys.writesToTty();
108-
const redForegroundEscapeSequence = shouldUseColors ? "\u001b[91m" : "";
109-
const yellowForegroundEscapeSequence = shouldUseColors ? "\u001b[93m" : "";
110-
const blueForegroundEscapeSequence = shouldUseColors ? "\u001b[93m" : "";
111-
const gutterStyleSequence = shouldUseColors ? "\u001b[100;30m" : "";
112-
const gutterSeparator = shouldUseColors ? " " : " | ";
113-
const resetEscapeSequence = shouldUseColors ? "\u001b[0m" : "";
107+
const redForegroundEscapeSequence = "\u001b[91m";
108+
const yellowForegroundEscapeSequence = "\u001b[93m";
109+
const blueForegroundEscapeSequence = "\u001b[93m";
110+
const gutterStyleSequence = "\u001b[100;30m";
111+
const gutterSeparator = " ";
112+
const resetEscapeSequence = "\u001b[0m";
114113
const elipsis = "...";
115114
const categoryFormatMap: Map<string> = {
116115
[DiagnosticCategory.Warning]: yellowForegroundEscapeSequence,

0 commit comments

Comments
 (0)