mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Revendor github.com/Nvveen/Gotty for github.com/Nvveen/Gotty#2
This fixes https://github.com/docker/docker/issues/32400 We were already actually vendoring from github.com/ijc25/Gotty in order to pickup github.com/Nvveen/Gotty#1. github.com/ijc25/Gotty#master now contains merges of both of those upstream PRs. Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
parent
5b18e7c396
commit
b7ced33036
2 changed files with 20 additions and 22 deletions
|
@ -131,7 +131,7 @@ github.com/spf13/cobra v1.5.1 https://github.com/dnephin/cobra.git
|
||||||
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
|
github.com/spf13/pflag 9ff6c6923cfffbcd502984b8e0c80539a94968b7
|
||||||
github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
|
github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
|
||||||
github.com/flynn-archive/go-shlex 3f9db97f856818214da2e1057f8ad84803971cff
|
github.com/flynn-archive/go-shlex 3f9db97f856818214da2e1057f8ad84803971cff
|
||||||
github.com/Nvveen/Gotty 6018b68f96b839edfbe3fb48668853f5dbad88a3 https://github.com/ijc25/Gotty
|
github.com/Nvveen/Gotty a8b993ba6abdb0e0c12b0125c603323a71c7790c https://github.com/ijc25/Gotty
|
||||||
|
|
||||||
# metrics
|
# metrics
|
||||||
github.com/docker/go-metrics 86138d05f285fd9737a99bee2d9be30866b59d72
|
github.com/docker/go-metrics 86138d05f285fd9737a99bee2d9be30866b59d72
|
||||||
|
|
40
vendor/github.com/Nvveen/Gotty/gotty.go
generated
vendored
40
vendor/github.com/Nvveen/Gotty/gotty.go
generated
vendored
|
@ -13,6 +13,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -22,33 +23,30 @@ import (
|
||||||
// If something went wrong reading the terminfo database file, an error is
|
// If something went wrong reading the terminfo database file, an error is
|
||||||
// returned.
|
// returned.
|
||||||
func OpenTermInfo(termName string) (*TermInfo, error) {
|
func OpenTermInfo(termName string) (*TermInfo, error) {
|
||||||
var term *TermInfo
|
if len(termName) == 0 {
|
||||||
var err error
|
return nil, errors.New("No termname given")
|
||||||
|
}
|
||||||
// Find the environment variables
|
// Find the environment variables
|
||||||
termloc := os.Getenv("TERMINFO")
|
if termloc := os.Getenv("TERMINFO"); len(termloc) > 0 {
|
||||||
if len(termloc) == 0 {
|
return readTermInfo(path.Join(termloc, string(termName[0]), termName))
|
||||||
|
} else {
|
||||||
// Search like ncurses
|
// Search like ncurses
|
||||||
locations := []string{os.Getenv("HOME") + "/.terminfo/", "/etc/terminfo/",
|
locations := []string{}
|
||||||
"/lib/terminfo/", "/usr/share/terminfo/"}
|
if h := os.Getenv("HOME"); len(h) > 0 {
|
||||||
var path string
|
locations = append(locations, path.Join(h, ".terminfo"))
|
||||||
|
}
|
||||||
|
locations = append(locations,
|
||||||
|
"/etc/terminfo/",
|
||||||
|
"/lib/terminfo/",
|
||||||
|
"/usr/share/terminfo/")
|
||||||
for _, str := range locations {
|
for _, str := range locations {
|
||||||
// Construct path
|
term, err := readTermInfo(path.Join(str, string(termName[0]), termName))
|
||||||
path = str + string(termName[0]) + "/" + termName
|
if err == nil {
|
||||||
// Check if path can be opened
|
return term, nil
|
||||||
file, _ := os.Open(path)
|
|
||||||
if file != nil {
|
|
||||||
// Path can open, fall out and use current path
|
|
||||||
file.Close()
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(path) > 0 {
|
return nil, errors.New("No terminfo file(-location) found")
|
||||||
term, err = readTermInfo(path)
|
|
||||||
} else {
|
|
||||||
err = errors.New(fmt.Sprintf("No terminfo file(-location) found"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return term, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open a terminfo file from the environment variable containing the current
|
// Open a terminfo file from the environment variable containing the current
|
||||||
|
|
Loading…
Add table
Reference in a new issue