amseltools/vendor/github.com/muesli/termenv/termenv_posix.go
2023-03-29 13:26:21 +00:00

18 lines
336 B
Go

//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
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()
}