vendor/github.com/mattn/go-isatty/isatty_solaris.go
changeset 256 6d9efbef00a9
parent 251 1c52a0eeb952
child 260 445e01aede7e
equal deleted inserted replaced
255:4f153a23adab 256:6d9efbef00a9
     6 import (
     6 import (
     7 	"golang.org/x/sys/unix"
     7 	"golang.org/x/sys/unix"
     8 )
     8 )
     9 
     9 
    10 // IsTerminal returns true if the given file descriptor is a terminal.
    10 // IsTerminal returns true if the given file descriptor is a terminal.
    11 // see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
    11 // see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c
    12 func IsTerminal(fd uintptr) bool {
    12 func IsTerminal(fd uintptr) bool {
    13 	var termio unix.Termio
    13 	_, err := unix.IoctlGetTermio(int(fd), unix.TCGETA)
    14 	err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
       
    15 	return err == nil
    14 	return err == nil
    16 }
    15 }
    17 
    16 
    18 // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
    17 // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2
    19 // terminal. This is also always false on this environment.
    18 // terminal. This is also always false on this environment.