~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/mattn/go-isatty/isatty_bsd.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// +build darwin freebsd openbsd netbsd
2
 
 
3
 
package isatty
4
 
 
5
 
import (
6
 
        "syscall"
7
 
        "unsafe"
8
 
)
9
 
 
10
 
const ioctlReadTermios = syscall.TIOCGETA
11
 
 
12
 
// IsTerminal return true if the file descriptor is terminal.
13
 
func IsTerminal(fd uintptr) bool {
14
 
        var termios syscall.Termios
15
 
        _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
16
 
        return err == 0
17
 
}