github.com/jxskiss/gopkg/v2@v2.14.9-0.20240514120614-899f3e7952b4/zlog/internal/terminal/terminal_check_unix.go (about)

     1  //go:build (linux || aix || zos) && !js
     2  
     3  package terminal
     4  
     5  import "golang.org/x/sys/unix"
     6  
     7  const ioctlReadTermios = unix.TCGETS
     8  
     9  func isTerminal(fd int) bool {
    10  	_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
    11  	return err == nil
    12  }