Skip to content
Merged
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
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ go 1.24.1
require (
golang.org/x/image v0.25.0
golang.org/x/sys v0.31.0
golang.org/x/term v0.30.0
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ golang.org/x/image v0.25.0 h1:Y6uW6rH1y5y/LK1J8BPWZtr6yZ7hrsy6hFrXjgsc2fQ=
golang.org/x/image v0.25.0/go.mod h1:tCAmOEGthTtkalusGp1g3xa2gke8J6c2N565dTyl9Rs=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
10 changes: 10 additions & 0 deletions internal/core/term_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build unix

package core

import "golang.org/x/sys/unix"

func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlTermiosReq)
return err == nil
}
7 changes: 7 additions & 0 deletions internal/core/term_unix_bsd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build darwin || dragonfly || freebsd || netbsd || openbsd

package core

import "golang.org/x/sys/unix"

const ioctlTermiosReq = unix.TIOCGETA
7 changes: 7 additions & 0 deletions internal/core/term_unix_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build aix || linux || solaris || zos

package core

import "golang.org/x/sys/unix"

const ioctlTermiosReq = unix.TCGETS
11 changes: 11 additions & 0 deletions internal/core/term_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//go:build windows

package core

import "golang.org/x/sys/windows"

func isTerminal(fd int) bool {
var st uint32
err := windows.GetConsoleMode(windows.Handle(fd), &st)
return err == nil
}
6 changes: 2 additions & 4 deletions internal/core/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"encoding/json"
"os"
"runtime/debug"

"golang.org/x/term"
)

var (
Expand All @@ -20,8 +18,8 @@ var (

func init() {
// Determine if stderr and stdout are TTYs.
IsStderrTerm = term.IsTerminal(int(os.Stderr.Fd()))
IsStdoutTerm = term.IsTerminal(int(os.Stdout.Fd()))
IsStderrTerm = isTerminal(int(os.Stderr.Fd()))
IsStdoutTerm = isTerminal(int(os.Stdout.Fd()))

// Set executable version and user-agent.
Version = getVersion()
Expand Down