Skip to content

Commit a3e5bb8

Browse files
authored
Merge pull request #108 from compnerd/windows-terminal
TSCBasic: use the "portable" names for `terminalType`
2 parents 25249a7 + 1423c1e commit a3e5bb8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/TSCBasic/TerminalController.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@ public final class TerminalController {
109109

110110
/// Computes the terminal type of the stream.
111111
public static func terminalType(_ stream: LocalFileOutputByteStream) -> TerminalType {
112+
#if os(Windows)
113+
return _isatty(_fileno(stream.filePointer)) == 0 ? .file : .tty
114+
#else
112115
if ProcessEnv.vars["TERM"] == "dumb" {
113116
return .dumb
114117
}
115118
let isTTY = isatty(fileno(stream.filePointer)) != 0
116119
return isTTY ? .tty : .file
120+
#endif
117121
}
118122

119123
/// Tries to get the terminal width first using COLUMNS env variable and

0 commit comments

Comments
 (0)