diff options
Diffstat (limited to 'vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go')
-rw-r--r-- | vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go new file mode 100644 index 0000000..b343b3a --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_notwindows.go | |||
@@ -0,0 +1,21 @@ | |||
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. | ||
5 | |||
6 | // +build linux darwin freebsd openbsd netbsd dragonfly | ||
7 | |||
8 | package logrus | ||
9 | |||
10 | import ( | ||
11 | "syscall" | ||
12 | "unsafe" | ||
13 | ) | ||
14 | |||
15 | // IsTerminal returns true if stderr's file descriptor is a terminal. | ||
16 | func IsTerminal() bool { | ||
17 | fd := syscall.Stderr | ||
18 | var termios Termios | ||
19 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) | ||
20 | return err == 0 | ||
21 | } | ||