diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-09 15:08:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 15:08:46 +0200 |
commit | 04270a080d4a06e671da9d2d7e6e15f6108338d9 (patch) | |
tree | 49116c6281fc4ab6cfac6bb5c9fb9600cdcd4573 /vendor/github.com/chzyer/readline | |
parent | 8a2ab7c387928782d8a1893c99974638054a0ad0 (diff) | |
parent | 8e1aa7af3a3d4fac1aefa94ed4a4455ac190ead9 (diff) | |
download | podman-04270a080d4a06e671da9d2d7e6e15f6108338d9.tar.gz podman-04270a080d4a06e671da9d2d7e6e15f6108338d9.tar.bz2 podman-04270a080d4a06e671da9d2d7e6e15f6108338d9.zip |
Merge pull request #15695 from Luap99/update-buildah
Update buildah and c/common to latest
Diffstat (limited to 'vendor/github.com/chzyer/readline')
-rw-r--r-- | vendor/github.com/chzyer/readline/README.md | 2 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/go.mod | 10 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/go.sum | 6 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/operation.go | 6 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/readline.go | 18 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/runebuf.go | 6 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/term.go | 2 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/term_nosyscall6.go (renamed from vendor/github.com/chzyer/readline/term_solaris.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/terminal.go | 16 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/utils.go | 34 | ||||
-rw-r--r-- | vendor/github.com/chzyer/readline/utils_unix.go | 2 |
11 files changed, 94 insertions, 10 deletions
diff --git a/vendor/github.com/chzyer/readline/README.md b/vendor/github.com/chzyer/readline/README.md index fab974b7f..4b0a5ff58 100644 --- a/vendor/github.com/chzyer/readline/README.md +++ b/vendor/github.com/chzyer/readline/README.md @@ -11,7 +11,7 @@ <img src="https://raw.githubusercontent.com/chzyer/readline/assets/logo_f.png" /> </p> -A powerful readline library in `Linux` `macOS` `Windows` `Solaris` +A powerful readline library in `Linux` `macOS` `Windows` `Solaris` `AIX` ## Guide diff --git a/vendor/github.com/chzyer/readline/go.mod b/vendor/github.com/chzyer/readline/go.mod new file mode 100644 index 000000000..66180f6b1 --- /dev/null +++ b/vendor/github.com/chzyer/readline/go.mod @@ -0,0 +1,10 @@ +module github.com/chzyer/readline + +go 1.15 + +require ( + github.com/chzyer/test v1.0.0 + golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 +) + +require github.com/chzyer/logex v1.2.1 diff --git a/vendor/github.com/chzyer/readline/go.sum b/vendor/github.com/chzyer/readline/go.sum new file mode 100644 index 000000000..2358df088 --- /dev/null +++ b/vendor/github.com/chzyer/readline/go.sum @@ -0,0 +1,6 @@ +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/chzyer/readline/operation.go b/vendor/github.com/chzyer/readline/operation.go index 4c31624f8..b60939a91 100644 --- a/vendor/github.com/chzyer/readline/operation.go +++ b/vendor/github.com/chzyer/readline/operation.go @@ -109,10 +109,12 @@ func (o *Operation) ioloop() { keepInSearchMode := false keepInCompleteMode := false r := o.t.ReadRune() + if o.GetConfig().FuncFilterInputRune != nil { var process bool r, process = o.GetConfig().FuncFilterInputRune(r) if !process { + o.t.KickRead() o.buf.Refresh(nil) // to refresh the line continue // ignore this rune } @@ -434,6 +436,10 @@ func (o *Operation) Slice() ([]byte, error) { } func (o *Operation) Close() { + select { + case o.errchan <- io.EOF: + default: + } o.history.Close() } diff --git a/vendor/github.com/chzyer/readline/readline.go b/vendor/github.com/chzyer/readline/readline.go index 0e7aca06d..63b917101 100644 --- a/vendor/github.com/chzyer/readline/readline.go +++ b/vendor/github.com/chzyer/readline/readline.go @@ -17,7 +17,9 @@ // package readline -import "io" +import ( + "io" +) type Instance struct { Config *Config @@ -270,14 +272,24 @@ func (i *Instance) ReadSlice() ([]byte, error) { } // we must make sure that call Close() before process exit. +// if there has a pending reading operation, that reading will be interrupted. +// so you can capture the signal and call Instance.Close(), it's thread-safe. func (i *Instance) Close() error { + i.Config.Stdin.Close() + i.Operation.Close() if err := i.Terminal.Close(); err != nil { return err } - i.Config.Stdin.Close() - i.Operation.Close() return nil } + +// call CaptureExitSignal when you want readline exit gracefully. +func (i *Instance) CaptureExitSignal() { + CaptureExitSignal(func() { + i.Close() + }) +} + func (i *Instance) Clean() { i.Operation.Clean() } diff --git a/vendor/github.com/chzyer/readline/runebuf.go b/vendor/github.com/chzyer/readline/runebuf.go index 81d2da50c..d95df1e36 100644 --- a/vendor/github.com/chzyer/readline/runebuf.go +++ b/vendor/github.com/chzyer/readline/runebuf.go @@ -35,7 +35,7 @@ type RuneBuffer struct { sync.Mutex } -func (r* RuneBuffer) pushKill(text []rune) { +func (r *RuneBuffer) pushKill(text []rune) { r.lastKill = append([]rune{}, text...) } @@ -221,7 +221,7 @@ func (r *RuneBuffer) DeleteWord() { } for i := init + 1; i < len(r.buf); i++ { if !IsWordBreak(r.buf[i]) && IsWordBreak(r.buf[i-1]) { - r.pushKill(r.buf[r.idx:i-1]) + r.pushKill(r.buf[r.idx : i-1]) r.Refresh(func() { r.buf = append(r.buf[:r.idx], r.buf[i-1:]...) }) @@ -350,7 +350,7 @@ func (r *RuneBuffer) Yank() { return } r.Refresh(func() { - buf := make([]rune, 0, len(r.buf) + len(r.lastKill)) + buf := make([]rune, 0, len(r.buf)+len(r.lastKill)) buf = append(buf, r.buf[:r.idx]...) buf = append(buf, r.lastKill...) buf = append(buf, r.buf[r.idx:]...) diff --git a/vendor/github.com/chzyer/readline/term.go b/vendor/github.com/chzyer/readline/term.go index 133993ca8..ea5db9346 100644 --- a/vendor/github.com/chzyer/readline/term.go +++ b/vendor/github.com/chzyer/readline/term.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux,!appengine netbsd openbsd os400 solaris // Package terminal provides support functions for dealing with terminals, as // commonly found on UNIX systems. diff --git a/vendor/github.com/chzyer/readline/term_solaris.go b/vendor/github.com/chzyer/readline/term_nosyscall6.go index 4c27273c7..df9233937 100644 --- a/vendor/github.com/chzyer/readline/term_solaris.go +++ b/vendor/github.com/chzyer/readline/term_nosyscall6.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build solaris +// +build aix os400 solaris package readline diff --git a/vendor/github.com/chzyer/readline/terminal.go b/vendor/github.com/chzyer/readline/terminal.go index 1078631c1..38413d0cf 100644 --- a/vendor/github.com/chzyer/readline/terminal.go +++ b/vendor/github.com/chzyer/readline/terminal.go @@ -125,6 +125,7 @@ func (t *Terminal) ioloop() { var ( isEscape bool isEscapeEx bool + isEscapeSS3 bool expectNextChar bool ) @@ -152,9 +153,15 @@ func (t *Terminal) ioloop() { if isEscape { isEscape = false if r == CharEscapeEx { + // ^][ expectNextChar = true isEscapeEx = true continue + } else if r == CharO { + // ^]O + expectNextChar = true + isEscapeSS3 = true + continue } r = escapeKey(r, buf) } else if isEscapeEx { @@ -177,6 +184,15 @@ func (t *Terminal) ioloop() { expectNextChar = true continue } + } else if isEscapeSS3 { + isEscapeSS3 = false + if key := readEscKey(r, buf); key != nil { + r = escapeSS3Key(key) + } + if r == 0 { + expectNextChar = true + continue + } } expectNextChar = true diff --git a/vendor/github.com/chzyer/readline/utils.go b/vendor/github.com/chzyer/readline/utils.go index af4e00521..0706dd4ec 100644 --- a/vendor/github.com/chzyer/readline/utils.go +++ b/vendor/github.com/chzyer/readline/utils.go @@ -6,9 +6,11 @@ import ( "container/list" "fmt" "os" + "os/signal" "strconv" "strings" "sync" + "syscall" "time" "unicode" ) @@ -41,6 +43,7 @@ const ( CharCtrlY = 25 CharCtrlZ = 26 CharEsc = 27 + CharO = 79 CharEscapeEx = 91 CharBackspace = 127 ) @@ -121,6 +124,27 @@ func escapeExKey(key *escapeKeyPair) rune { return r } +// translate EscOX SS3 codes for up/down/etc. +func escapeSS3Key(key *escapeKeyPair) rune { + var r rune + switch key.typ { + case 'D': + r = CharBackward + case 'C': + r = CharForward + case 'A': + r = CharPrev + case 'B': + r = CharNext + case 'H': + r = CharLineStart + case 'F': + r = CharLineEnd + default: + } + return r +} + type escapeKeyPair struct { attr string typ rune @@ -275,3 +299,13 @@ func Debug(o ...interface{}) { fmt.Fprintln(f, o...) f.Close() } + +func CaptureExitSignal(f func()) { + cSignal := make(chan os.Signal, 1) + signal.Notify(cSignal, os.Interrupt, syscall.SIGTERM) + go func() { + for range cSignal { + f() + } + }() +} diff --git a/vendor/github.com/chzyer/readline/utils_unix.go b/vendor/github.com/chzyer/readline/utils_unix.go index f88dac97b..fc4949232 100644 --- a/vendor/github.com/chzyer/readline/utils_unix.go +++ b/vendor/github.com/chzyer/readline/utils_unix.go @@ -1,4 +1,4 @@ -// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux,!appengine netbsd openbsd os400 solaris package readline |