vendor: golang.org/x/term v0.46.0

- all: upgrade go directive to at least 1.26.0
- term: process bytes returned with a read error
    - fixes: x/term: ReadLine discards data returned with io.EOF

full diff: https://github.com/golang/term/compare/v0.45.0...v0.46.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-09-14 17:30:22 +02:00
parent f90c2894a8
commit b0a6803f9b
4 changed files with 22 additions and 12 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ require (
go.yaml.in/yaml/v3 v3.0.5
golang.org/x/sync v0.23.0
golang.org/x/sys v0.48.0
golang.org/x/term v0.45.0
golang.org/x/term v0.46.0
golang.org/x/text v0.42.0
gotest.tools/v3 v3.5.2
tags.cncf.io/container-device-interface v1.1.1
+2 -2
View File
@@ -207,8 +207,8 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0=
golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w=
golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
+17 -7
View File
@@ -106,6 +106,9 @@ type Terminal struct {
// a read. It aliases into inBuf.
remainder []byte
inBuf [256]byte
// readErr is an error returned by a read that also returned data. It is
// reported after all of that data has been processed.
readErr error
// History records and retrieves lines of input read by [ReadLine] which
// a user can retrieve and navigate using the up and down arrow keys.
@@ -788,7 +791,11 @@ func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
return
}
// ReadLine returns a line of input from the terminal.
// ReadLine returns a line of input from the terminal, excluding the
// trailing newline. It may return partial data along with an error.
// An [io.EOF] error indicates the end of the stream. For other errors,
// such as [ErrPasteIndicator] in bracketed paste mode, a subsequent
// call may return more data.
func (t *Terminal) ReadLine() (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
@@ -863,21 +870,24 @@ func (t *Terminal) readLine() (line string, err error) {
}
return
}
if t.readErr != nil {
err = t.readErr
t.readErr = nil
return
}
// t.remainder is a slice at the beginning of t.inBuf
// containing a partial key sequence
readBuf := t.inBuf[len(t.remainder):]
var n int
t.lock.Unlock()
n, err = t.c.Read(readBuf)
n, readErr := t.c.Read(readBuf)
t.lock.Lock()
if err != nil {
return
}
t.remainder = t.inBuf[:n+len(t.remainder)]
if readErr != nil {
t.readErr = readErr
}
}
}
+2 -2
View File
@@ -416,8 +416,8 @@ golang.org/x/sys/plan9
golang.org/x/sys/unix
golang.org/x/sys/windows
golang.org/x/sys/windows/registry
# golang.org/x/term v0.45.0
## explicit; go 1.25.0
# golang.org/x/term v0.46.0
## explicit; go 1.26.0
golang.org/x/term
# golang.org/x/text v0.42.0
## explicit; go 1.26.0