mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
15 lines
293 B
Go
15 lines
293 B
Go
|
//go:build darwin || linux || solaris
|
||
|
// +build darwin linux solaris
|
||
|
|
||
|
package terminal
|
||
|
|
||
|
import (
|
||
|
"golang.org/x/sys/unix"
|
||
|
)
|
||
|
|
||
|
// IsTerminal returns true if the file descriptor is terminal
|
||
|
func IsTerminal(fd int) bool {
|
||
|
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
|
||
|
return err == nil
|
||
|
}
|