Added Windows support

This commit is contained in:
Eduard Urbach 2025-02-11 12:19:55 +01:00
parent 082164c2a1
commit 9f6283216c
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
3 changed files with 8 additions and 4 deletions

2
go.mod
View File

@ -4,5 +4,5 @@ go 1.22.0
require (
git.akyoto.dev/go/assert v0.1.3
golang.org/x/sys v0.18.0
golang.org/x/sys v0.30.0
)

4
go.sum
View File

@ -1,4 +1,4 @@
git.akyoto.dev/go/assert v0.1.3 h1:QwCUbmG4aZYsNk/OuRBz1zWVKmGlDUHhOnnDBfn8Qw8=
git.akyoto.dev/go/assert v0.1.3/go.mod h1:0GzMaM0eURuDwtGkJJkCsI7r2aUKr+5GmWNTFPgDocM=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

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
}