Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/std/os.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,10 @@ pub const WriteError = error{

/// Connection reset by peer.
ConnectionResetByPeer,

/// This error occurs when trying to write UTF-8 text to a Windows console,
/// and the UTF-8 to UTF-16 conversion fails. Windows-only.
InvalidUtf8,
} || UnexpectedError;

/// Write to a file descriptor.
Expand Down Expand Up @@ -3239,8 +3243,7 @@ pub fn isatty(handle: fd_t) bool {
if (isCygwinPty(handle))
return true;

var out: windows.DWORD = undefined;
return windows.kernel32.GetConsoleMode(handle, &out) != 0;
return windows.IsConsoleHandle(handle);
}
if (builtin.link_libc) {
return system.isatty(handle) != 0;
Expand Down
Loading