...

Source file src/github.com/muesli/termenv/termenv_posix.go

Documentation: github.com/muesli/termenv

     1  //go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
     2  // +build darwin dragonfly freebsd linux netbsd openbsd
     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  	return pgrp == unix.Getpgrp()
    17  }
    18  

View as plain text