diff options
author | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
---|---|---|
committer | Nathan Dench <ndenc2@gmail.com> | 2019-05-24 15:16:44 +1000 |
commit | 107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch) | |
tree | ca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/mattn/go-isatty | |
parent | 844b5a68d8af4791755b8f0ad293cc99f5959183 (diff) | |
download | terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip |
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/mattn/go-isatty')
-rw-r--r-- | vendor/github.com/mattn/go-isatty/.travis.yml | 13 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/README.md | 17 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/go.mod | 3 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/go.sum | 2 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_appengine.go | 9 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_bsd.go | 6 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_linux.go | 18 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_others.go | 15 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_solaris.go | 6 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-isatty/isatty_windows.go | 79 |
10 files changed, 146 insertions, 22 deletions
diff --git a/vendor/github.com/mattn/go-isatty/.travis.yml b/vendor/github.com/mattn/go-isatty/.travis.yml new file mode 100644 index 0000000..5597e02 --- /dev/null +++ b/vendor/github.com/mattn/go-isatty/.travis.yml | |||
@@ -0,0 +1,13 @@ | |||
1 | language: go | ||
2 | go: | ||
3 | - tip | ||
4 | |||
5 | os: | ||
6 | - linux | ||
7 | - osx | ||
8 | |||
9 | before_install: | ||
10 | - go get github.com/mattn/goveralls | ||
11 | - go get golang.org/x/tools/cmd/cover | ||
12 | script: | ||
13 | - $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5 | ||
diff --git a/vendor/github.com/mattn/go-isatty/README.md b/vendor/github.com/mattn/go-isatty/README.md index 74845de..1e69004 100644 --- a/vendor/github.com/mattn/go-isatty/README.md +++ b/vendor/github.com/mattn/go-isatty/README.md | |||
@@ -1,5 +1,10 @@ | |||
1 | # go-isatty | 1 | # go-isatty |
2 | 2 | ||
3 | [![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty) | ||
4 | [![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty) | ||
5 | [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master) | ||
6 | [![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty) | ||
7 | |||
3 | isatty for golang | 8 | isatty for golang |
4 | 9 | ||
5 | ## Usage | 10 | ## Usage |
@@ -16,6 +21,8 @@ import ( | |||
16 | func main() { | 21 | func main() { |
17 | if isatty.IsTerminal(os.Stdout.Fd()) { | 22 | if isatty.IsTerminal(os.Stdout.Fd()) { |
18 | fmt.Println("Is Terminal") | 23 | fmt.Println("Is Terminal") |
24 | } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) { | ||
25 | fmt.Println("Is Cygwin/MSYS2 Terminal") | ||
19 | } else { | 26 | } else { |
20 | fmt.Println("Is Not Terminal") | 27 | fmt.Println("Is Not Terminal") |
21 | } | 28 | } |
@@ -28,10 +35,16 @@ func main() { | |||
28 | $ go get github.com/mattn/go-isatty | 35 | $ go get github.com/mattn/go-isatty |
29 | ``` | 36 | ``` |
30 | 37 | ||
31 | # License | 38 | ## License |
32 | 39 | ||
33 | MIT | 40 | MIT |
34 | 41 | ||
35 | # Author | 42 | ## Author |
36 | 43 | ||
37 | Yasuhiro Matsumoto (a.k.a mattn) | 44 | Yasuhiro Matsumoto (a.k.a mattn) |
45 | |||
46 | ## Thanks | ||
47 | |||
48 | * k-takata: base idea for IsCygwinTerminal | ||
49 | |||
50 | https://github.com/k-takata/go-iscygpty | ||
diff --git a/vendor/github.com/mattn/go-isatty/go.mod b/vendor/github.com/mattn/go-isatty/go.mod new file mode 100644 index 0000000..f310320 --- /dev/null +++ b/vendor/github.com/mattn/go-isatty/go.mod | |||
@@ -0,0 +1,3 @@ | |||
1 | module github.com/mattn/go-isatty | ||
2 | |||
3 | require golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 | ||
diff --git a/vendor/github.com/mattn/go-isatty/go.sum b/vendor/github.com/mattn/go-isatty/go.sum new file mode 100644 index 0000000..426c897 --- /dev/null +++ b/vendor/github.com/mattn/go-isatty/go.sum | |||
@@ -0,0 +1,2 @@ | |||
1 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8= | ||
2 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||
diff --git a/vendor/github.com/mattn/go-isatty/isatty_appengine.go b/vendor/github.com/mattn/go-isatty/isatty_appengine.go deleted file mode 100644 index 83c5887..0000000 --- a/vendor/github.com/mattn/go-isatty/isatty_appengine.go +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | // +build appengine | ||
2 | |||
3 | package isatty | ||
4 | |||
5 | // IsTerminal returns true if the file descriptor is terminal which | ||
6 | // is always false on on appengine classic which is a sandboxed PaaS. | ||
7 | func IsTerminal(fd uintptr) bool { | ||
8 | return false | ||
9 | } | ||
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go index 42f2514..07e9303 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go +++ b/vendor/github.com/mattn/go-isatty/isatty_bsd.go | |||
@@ -16,3 +16,9 @@ func IsTerminal(fd uintptr) bool { | |||
16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) | 16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) |
17 | return err == 0 | 17 | return err == 0 |
18 | } | 18 | } |
19 | |||
20 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 | ||
21 | // terminal. This is also always false on this environment. | ||
22 | func IsCygwinTerminal(fd uintptr) bool { | ||
23 | return false | ||
24 | } | ||
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux.go b/vendor/github.com/mattn/go-isatty/isatty_linux.go index 9d24bac..e004038 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_linux.go +++ b/vendor/github.com/mattn/go-isatty/isatty_linux.go | |||
@@ -3,16 +3,16 @@ | |||
3 | 3 | ||
4 | package isatty | 4 | package isatty |
5 | 5 | ||
6 | import ( | 6 | import "golang.org/x/sys/unix" |
7 | "syscall" | ||
8 | "unsafe" | ||
9 | ) | ||
10 | |||
11 | const ioctlReadTermios = syscall.TCGETS | ||
12 | 7 | ||
13 | // IsTerminal return true if the file descriptor is terminal. | 8 | // IsTerminal return true if the file descriptor is terminal. |
14 | func IsTerminal(fd uintptr) bool { | 9 | func IsTerminal(fd uintptr) bool { |
15 | var termios syscall.Termios | 10 | _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS) |
16 | _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0) | 11 | return err == nil |
17 | return err == 0 | 12 | } |
13 | |||
14 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 | ||
15 | // terminal. This is also always false on this environment. | ||
16 | func IsCygwinTerminal(fd uintptr) bool { | ||
17 | return false | ||
18 | } | 18 | } |
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others.go b/vendor/github.com/mattn/go-isatty/isatty_others.go new file mode 100644 index 0000000..f02849c --- /dev/null +++ b/vendor/github.com/mattn/go-isatty/isatty_others.go | |||
@@ -0,0 +1,15 @@ | |||
1 | // +build appengine js | ||
2 | |||
3 | package isatty | ||
4 | |||
5 | // IsTerminal returns true if the file descriptor is terminal which | ||
6 | // is always false on js and appengine classic which is a sandboxed PaaS. | ||
7 | func IsTerminal(fd uintptr) bool { | ||
8 | return false | ||
9 | } | ||
10 | |||
11 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 | ||
12 | // terminal. This is also always false on this environment. | ||
13 | func IsCygwinTerminal(fd uintptr) bool { | ||
14 | return false | ||
15 | } | ||
diff --git a/vendor/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go index 1f0c6bf..bdd5c79 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_solaris.go +++ b/vendor/github.com/mattn/go-isatty/isatty_solaris.go | |||
@@ -14,3 +14,9 @@ func IsTerminal(fd uintptr) bool { | |||
14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) | 14 | err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio) |
15 | return err == nil | 15 | return err == nil |
16 | } | 16 | } |
17 | |||
18 | // IsCygwinTerminal return true if the file descriptor is a cygwin or msys2 | ||
19 | // terminal. This is also always false on this environment. | ||
20 | func IsCygwinTerminal(fd uintptr) bool { | ||
21 | return false | ||
22 | } | ||
diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go index 83c398b..af51cbc 100644 --- a/vendor/github.com/mattn/go-isatty/isatty_windows.go +++ b/vendor/github.com/mattn/go-isatty/isatty_windows.go | |||
@@ -4,12 +4,30 @@ | |||
4 | package isatty | 4 | package isatty |
5 | 5 | ||
6 | import ( | 6 | import ( |
7 | "strings" | ||
7 | "syscall" | 8 | "syscall" |
9 | "unicode/utf16" | ||
8 | "unsafe" | 10 | "unsafe" |
9 | ) | 11 | ) |
10 | 12 | ||
11 | var kernel32 = syscall.NewLazyDLL("kernel32.dll") | 13 | const ( |
12 | var procGetConsoleMode = kernel32.NewProc("GetConsoleMode") | 14 | fileNameInfo uintptr = 2 |
15 | fileTypePipe = 3 | ||
16 | ) | ||
17 | |||
18 | var ( | ||
19 | kernel32 = syscall.NewLazyDLL("kernel32.dll") | ||
20 | procGetConsoleMode = kernel32.NewProc("GetConsoleMode") | ||
21 | procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx") | ||
22 | procGetFileType = kernel32.NewProc("GetFileType") | ||
23 | ) | ||
24 | |||
25 | func init() { | ||
26 | // Check if GetFileInformationByHandleEx is available. | ||
27 | if procGetFileInformationByHandleEx.Find() != nil { | ||
28 | procGetFileInformationByHandleEx = nil | ||
29 | } | ||
30 | } | ||
13 | 31 | ||
14 | // IsTerminal return true if the file descriptor is terminal. | 32 | // IsTerminal return true if the file descriptor is terminal. |
15 | func IsTerminal(fd uintptr) bool { | 33 | func IsTerminal(fd uintptr) bool { |
@@ -17,3 +35,60 @@ func IsTerminal(fd uintptr) bool { | |||
17 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) | 35 | r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) |
18 | return r != 0 && e == 0 | 36 | return r != 0 && e == 0 |
19 | } | 37 | } |
38 | |||
39 | // Check pipe name is used for cygwin/msys2 pty. | ||
40 | // Cygwin/MSYS2 PTY has a name like: | ||
41 | // \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master | ||
42 | func isCygwinPipeName(name string) bool { | ||
43 | token := strings.Split(name, "-") | ||
44 | if len(token) < 5 { | ||
45 | return false | ||
46 | } | ||
47 | |||
48 | if token[0] != `\msys` && token[0] != `\cygwin` { | ||
49 | return false | ||
50 | } | ||
51 | |||
52 | if token[1] == "" { | ||
53 | return false | ||
54 | } | ||
55 | |||
56 | if !strings.HasPrefix(token[2], "pty") { | ||
57 | return false | ||
58 | } | ||
59 | |||
60 | if token[3] != `from` && token[3] != `to` { | ||
61 | return false | ||
62 | } | ||
63 | |||
64 | if token[4] != "master" { | ||
65 | return false | ||
66 | } | ||
67 | |||
68 | return true | ||
69 | } | ||
70 | |||
71 | // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 | ||
72 | // terminal. | ||
73 | func IsCygwinTerminal(fd uintptr) bool { | ||
74 | if procGetFileInformationByHandleEx == nil { | ||
75 | return false | ||
76 | } | ||
77 | |||
78 | // Cygwin/msys's pty is a pipe. | ||
79 | ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0) | ||
80 | if ft != fileTypePipe || e != 0 { | ||
81 | return false | ||
82 | } | ||
83 | |||
84 | var buf [2 + syscall.MAX_PATH]uint16 | ||
85 | r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), | ||
86 | 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)), | ||
87 | uintptr(len(buf)*2), 0, 0) | ||
88 | if r == 0 || e != 0 { | ||
89 | return false | ||
90 | } | ||
91 | |||
92 | l := *(*uint32)(unsafe.Pointer(&buf)) | ||
93 | return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2]))) | ||
94 | } | ||