Skip to content

Commit ba7fade

Browse files
Add support to tell whether output directs to a terminal emulator.
1 parent fe46122 commit ba7fade

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/compiler/sys.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace ts {
66
newLine: string;
77
useCaseSensitiveFileNames: boolean;
88
write(s: string): void;
9+
writesToTty?(): boolean;
910
readFile(path: string, encoding?: string): string;
1011
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
1112
watchFile?(path: string, callback: (path: string) => void): FileWatcher;
@@ -187,7 +188,8 @@ namespace ts {
187188
function getNodeSystem(): System {
188189
var _fs = require("fs");
189190
var _path = require("path");
190-
var _os = require('os');
191+
var _os = require("os");
192+
var _tty = require("tty");
191193

192194
var platform: string = _os.platform();
193195
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
@@ -271,6 +273,7 @@ namespace ts {
271273
// 1 is a standard descriptor for stdout
272274
_fs.writeSync(1, s);
273275
},
276+
writesToTty: () => _tty.isatty(1),
274277
readFile,
275278
writeFile,
276279
watchFile: (fileName, callback) => {

0 commit comments

Comments
 (0)