twink/vendor/github.com/muesli/termenv/termenv_posix.go
2025-12-05 12:20:05 +01:00

17 lines
347 B
Go

//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos
// +build darwin dragonfly freebsd linux netbsd openbsd zos
package termenv
import (
"golang.org/x/sys/unix"
)
func isForeground(fd int) bool {
pgrp, err := unix.IoctlGetInt(fd, unix.TIOCGPGRP)
if err != nil {
return false
}
return pgrp == unix.Getpgrp()
}