| ... | @@ -230,6 +230,13 @@ pub const File = struct { | ... | @@ -230,6 +230,13 @@ pub const File = struct { |
| 230 | /// Test whether ANSI escape codes will be treated as such. | 230 | /// Test whether ANSI escape codes will be treated as such. |
| 231 | pub fn supportsAnsiEscapeCodes(self: File) bool { | 231 | pub fn supportsAnsiEscapeCodes(self: File) bool { |
| 232 | if (builtin.os.tag == .windows) { | 232 | if (builtin.os.tag == .windows) { |
| | 233 | if (!os.isatty(self.handle)) return false; |
| | 234 | |
| | 235 | var console_mode: os.windows.DWORD = 0; |
| | 236 | if (os.windows.kernel32.GetConsoleMode(self.handle, &console_mode) != 0) { |
| | 237 | if (console_mode & os.windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0) return true; |
| | 238 | } |
| | 239 | |
| 233 | return os.isCygwinPty(self.handle); | 240 | return os.isCygwinPty(self.handle); |
| 234 | } | 241 | } |
| 235 | if (builtin.os.tag == .wasi) { | 242 | if (builtin.os.tag == .wasi) { |