Update github.com/moby/term digest to 0564e01

Signed-off-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
renovate[bot]
2023-05-01 09:44:21 +00:00
committed by GitHub
parent 0429b6816b
commit 202701e653
8 changed files with 21 additions and 34 deletions

4
vendor/github.com/moby/term/tc.go generated vendored
View File

@@ -7,7 +7,7 @@ import (
"golang.org/x/sys/unix"
)
func tcget(fd uintptr) (*Termios, error) {
func tcget(fd uintptr) (*unix.Termios, error) {
p, err := unix.IoctlGetTermios(int(fd), getTermios)
if err != nil {
return nil, err
@@ -15,6 +15,6 @@ func tcget(fd uintptr) (*Termios, error) {
return p, nil
}
func tcset(fd uintptr, p *Termios) error {
func tcset(fd uintptr, p *unix.Termios) error {
return unix.IoctlSetTermios(int(fd), setTermios, p)
}

21
vendor/github.com/moby/term/term.go generated vendored
View File

@@ -7,10 +7,8 @@ package term
import (
"errors"
"fmt"
"io"
"os"
"os/signal"
"golang.org/x/sys/unix"
)
@@ -20,7 +18,7 @@ var ErrInvalidState = errors.New("Invalid terminal state")
// State represents the state of the terminal.
type State struct {
termios Termios
termios unix.Termios
}
// Winsize represents the size of the terminal window.
@@ -80,7 +78,6 @@ func DisableEcho(fd uintptr, state *State) error {
if err := tcset(fd, &newState); err != nil {
return err
}
handleInterrupt(fd, state)
return nil
}
@@ -92,7 +89,6 @@ func SetRawTerminal(fd uintptr) (*State, error) {
if err != nil {
return nil, err
}
handleInterrupt(fd, oldState)
return oldState, err
}
@@ -102,18 +98,3 @@ func SetRawTerminal(fd uintptr) (*State, error) {
func SetRawTerminalOutput(fd uintptr) (*State, error) {
return nil, nil
}
func handleInterrupt(fd uintptr, state *State) {
sigchan := make(chan os.Signal, 1)
signal.Notify(sigchan, os.Interrupt)
go func() {
for range sigchan {
// quit cleanly and the new terminal item is on a new line
fmt.Println()
signal.Stop(sigchan)
close(sigchan)
RestoreTerminal(fd, state)
os.Exit(1)
}
}()
}

View File

@@ -8,6 +8,8 @@ import (
)
// Termios is the Unix API for terminal I/O.
//
// Deprecated: use [unix.Termios].
type Termios = unix.Termios
// MakeRaw puts the terminal connected to the given file descriptor into raw
@@ -21,10 +23,10 @@ func MakeRaw(fd uintptr) (*State, error) {
oldState := State{termios: *termios}
termios.Iflag &^= (unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON)
termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
termios.Oflag &^= unix.OPOST
termios.Lflag &^= (unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN)
termios.Cflag &^= (unix.CSIZE | unix.PARENB)
termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
termios.Cflag &^= unix.CSIZE | unix.PARENB
termios.Cflag |= unix.CS8
termios.Cc[unix.VMIN] = 1
termios.Cc[unix.VTIME] = 0

View File

@@ -9,6 +9,7 @@ import (
"fmt"
"io"
"os"
"strconv"
"strings"
"unsafe"
@@ -195,10 +196,10 @@ func keyToString(keyEvent *winterm.KEY_EVENT_RECORD, escapeSequence []byte) stri
// <Alt>+Key generates ESC N Key
if !control && alt {
return ansiterm.KEY_ESC_N + strings.ToLower(string(keyEvent.UnicodeChar))
return ansiterm.KEY_ESC_N + strings.ToLower(strconv.Itoa(int(keyEvent.UnicodeChar)))
}
return string(keyEvent.UnicodeChar)
return strconv.Itoa(int(keyEvent.UnicodeChar))
}
// formatVirtualKey converts a virtual key (e.g., up arrow) into the appropriate ANSI string.

View File

@@ -30,8 +30,11 @@ func GetHandleInfo(in interface{}) (uintptr, bool) {
// IsConsole returns true if the given file descriptor is a Windows Console.
// The code assumes that GetConsoleMode will return an error for file descriptors that are not a console.
// Deprecated: use golang.org/x/sys/windows.GetConsoleMode() or golang.org/x/term.IsTerminal()
var IsConsole = isConsole
//
// Deprecated: use [windows.GetConsoleMode] or [golang.org/x/term.IsTerminal].
func IsConsole(fd uintptr) bool {
return isConsole(fd)
}
func isConsole(fd uintptr) bool {
var mode uint32