use x/sys for non-unix files

This commit is contained in:
dmathieu
2017-07-26 10:15:24 +02:00
parent f4125cea1b
commit 8a90bf3fff
4 changed files with 13 additions and 10 deletions
+3 -2
View File
@@ -11,8 +11,9 @@ package logrus
import (
"io"
"os"
"syscall"
"unsafe"
"golang.org/x/sys/unix"
)
// IsTerminal returns true if stderr's file descriptor is a terminal.
@@ -20,7 +21,7 @@ func IsTerminal(f io.Writer) bool {
var termios Termios
switch v := f.(type) {
case *os.File:
_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
_, _, err := unix.Syscall6(unix.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
return err == 0
default:
return false