| // 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 | |
| package isatty | |
| import ( | |
| "os" | |
| "syscall" | |
| "unsafe" | |
| ) | |
| func isTerminal() bool { | |
| var termios syscall.Termios | |
| _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, os.Stdout.Fd(), syscall.TCGETS, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) | |
| return err == 0 | |
| } |