1 // Based on ssh/terminal:
2 // Copyright 2011 The Go Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
6 // +build linux,!appengine darwin freebsd openbsd
16 // IsTerminal returns true if w writes to a terminal.
17 func IsTerminal(w io.Writer) bool {
22 var termios syscall.Termios
23 _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fw.Fd(), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)