blob: a468ae0cc65ca7e01e1e8188d3b1746079d4df85 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build linux darwin
package isatty
import (
"os"
"syscall"
"unsafe"
)
// IsTerminal returns whether the system is in a terminal.
func IsTerminal() bool {
var termios syscall.Termios
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, os.Stdout.Fd(), ioctlTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
}