1 //go:build solaris || illumos 2 // +build solaris illumos 3 4 package termenv 5 6 import ( 7 "golang.org/x/sys/unix" 8 ) 9 10 func isForeground(fd int) bool { 11 pgrp, err := unix.IoctlGetInt(fd, unix.TIOCGPGRP) 12 if err != nil { 13 return false 14 } 15 16 g, err := unix.Getpgrp() 17 if err != nil { 18 return false 19 } 20 21 return pgrp == g 22 } 23