Added Windows support

This commit is contained in:
Eduard Urbach 2025-02-11 12:19:55 +01:00
parent 77e626de5d
commit 77b109b517
Signed by: eduard
GPG key ID: 49226B848C78F6C8
3 changed files with 8 additions and 4 deletions

View file

@ -1,6 +1,10 @@
package tty
import "golang.org/x/sys/windows"
// IsTerminal returns true if the file descriptor is a terminal.
func IsTerminal(fd uintptr) bool {
return false
var mode uint32
err := windows.GetConsoleMode(windows.Handle(fd), &mode)
return err == nil
}