mirror of
https://github.com/ziglang/zig.git
synced 2026-01-09 08:55:36 +00:00
Remove unnecessary isatty call from supportsAnsiEscapeCodes
isatty on Windows is implemented as a isCygwinPty call and a GetConsoleMode call, so calling isatty just duplicates the function calls we already need to do in supportsAnsiEscapeCodes.
This commit is contained in:
parent
59a12cd293
commit
5439f36c97
@ -230,8 +230,6 @@ pub const File = struct {
|
||||
/// Test whether ANSI escape codes will be treated as such.
|
||||
pub fn supportsAnsiEscapeCodes(self: File) bool {
|
||||
if (builtin.os.tag == .windows) {
|
||||
if (!os.isatty(self.handle)) return false;
|
||||
|
||||
var console_mode: os.windows.DWORD = 0;
|
||||
if (os.windows.kernel32.GetConsoleMode(self.handle, &console_mode) != 0) {
|
||||
if (console_mode & os.windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0) return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user