mirror of
https://github.com/containers/podman.git
synced 2025-11-30 10:07:33 +08:00
Update github.com/moby/term digest to 0564e01
Signed-off-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
4
vendor/github.com/moby/term/tc.go
generated
vendored
4
vendor/github.com/moby/term/tc.go
generated
vendored
@@ -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
21
vendor/github.com/moby/term/term.go
generated
vendored
@@ -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)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
8
vendor/github.com/moby/term/termios.go
generated
vendored
8
vendor/github.com/moby/term/termios.go
generated
vendored
@@ -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
|
||||
|
||||
5
vendor/github.com/moby/term/windows/ansi_reader.go
generated
vendored
5
vendor/github.com/moby/term/windows/ansi_reader.go
generated
vendored
@@ -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.
|
||||
|
||||
7
vendor/github.com/moby/term/windows/console.go
generated
vendored
7
vendor/github.com/moby/term/windows/console.go
generated
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user