Update console dep to 84eeaae905fa414d03e07bcd6c8d
This change removes the ClearONLCR from the console package providing a console with the default settings from the console package. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
		
							
								
								
									
										10
									
								
								vendor/github.com/containerd/console/console.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/containerd/console/console.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -44,7 +44,13 @@ type WinSize struct {
 | 
			
		||||
 | 
			
		||||
// Current returns the current processes console
 | 
			
		||||
func Current() Console {
 | 
			
		||||
	return newMaster(os.Stdin)
 | 
			
		||||
	c, err := ConsoleFromFile(os.Stdin)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		// stdin should always be a console for the design
 | 
			
		||||
		// of this function
 | 
			
		||||
		panic(err)
 | 
			
		||||
	}
 | 
			
		||||
	return c
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ConsoleFromFile returns a console using the provided file
 | 
			
		||||
@@ -52,5 +58,5 @@ func ConsoleFromFile(f *os.File) (Console, error) {
 | 
			
		||||
	if err := checkConsole(f); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return newMaster(f), nil
 | 
			
		||||
	return newMaster(f)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								vendor/github.com/containerd/console/console_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								vendor/github.com/containerd/console/console_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -16,9 +16,6 @@ func NewPty() (Console, string, error) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
	}
 | 
			
		||||
	if err := saneTerminal(f); err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
	}
 | 
			
		||||
	slave, err := ptsname(f)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
@@ -26,9 +23,11 @@ func NewPty() (Console, string, error) {
 | 
			
		||||
	if err := unlockpt(f); err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
	}
 | 
			
		||||
	return &master{
 | 
			
		||||
		f: f,
 | 
			
		||||
	}, slave, nil
 | 
			
		||||
	m, err := newMaster(f)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
	}
 | 
			
		||||
	return m, slave, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type master struct {
 | 
			
		||||
@@ -72,9 +71,6 @@ func (m *master) getCurrent() (unix.Termios, error) {
 | 
			
		||||
	if err := tcget(m.f.Fd(), &termios); err != nil {
 | 
			
		||||
		return unix.Termios{}, err
 | 
			
		||||
	}
 | 
			
		||||
	if m.original == nil {
 | 
			
		||||
		m.original = &termios
 | 
			
		||||
	}
 | 
			
		||||
	return termios, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -118,17 +114,29 @@ func checkConsole(f *os.File) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newMaster(f *os.File) Console {
 | 
			
		||||
	return &master{
 | 
			
		||||
func newMaster(f *os.File) (Console, error) {
 | 
			
		||||
	m := &master{
 | 
			
		||||
		f: f,
 | 
			
		||||
	}
 | 
			
		||||
	t, err := m.getCurrent()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	m.original = &t
 | 
			
		||||
	return m, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SaneTerminal sets the necessary tty_ioctl(4)s to ensure that a pty pair
 | 
			
		||||
// ClearONLCR sets the necessary tty_ioctl(4)s to ensure that a pty pair
 | 
			
		||||
// created by us acts normally. In particular, a not-very-well-known default of
 | 
			
		||||
// Linux unix98 ptys is that they have +onlcr by default. While this isn't a
 | 
			
		||||
// problem for terminal emulators, because we relay data from the terminal we
 | 
			
		||||
// also relay that funky line discipline.
 | 
			
		||||
func SaneTerminal(f *os.File) error {
 | 
			
		||||
	return saneTerminal(f)
 | 
			
		||||
func ClearONLCR(fd uintptr) error {
 | 
			
		||||
	return setONLCR(fd, false)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetONLCR sets the necessary tty_ioctl(4)s to ensure that a pty pair
 | 
			
		||||
// created by us acts as intended for a terminal emulator.
 | 
			
		||||
func SetONLCR(fd uintptr) error {
 | 
			
		||||
	return setONLCR(fd, true)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/github.com/containerd/console/console_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/github.com/containerd/console/console_windows.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -190,13 +190,11 @@ func checkConsole(f *os.File) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newMaster(f *os.File) Console {
 | 
			
		||||
func newMaster(f *os.File) (Console, error) {
 | 
			
		||||
	if f != os.Stdin && f != os.Stdout && f != os.Stderr {
 | 
			
		||||
		panic("creating a console from a file is not supported on windows")
 | 
			
		||||
		return nil, errors.New("creating a console from a file is not supported on windows")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	m := &master{}
 | 
			
		||||
	m.initStdios()
 | 
			
		||||
 | 
			
		||||
	return m
 | 
			
		||||
	return m, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								vendor/github.com/containerd/console/tc_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/github.com/containerd/console/tc_unix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,8 +3,6 @@
 | 
			
		||||
package console
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
	"golang.org/x/sys/unix"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -49,14 +47,19 @@ func tcswinsz(fd uintptr, ws WinSize) error {
 | 
			
		||||
	return unix.IoctlSetWinsize(int(fd), unix.TIOCSWINSZ, &uws)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func saneTerminal(f *os.File) error {
 | 
			
		||||
func setONLCR(fd uintptr, enable bool) error {
 | 
			
		||||
	var termios unix.Termios
 | 
			
		||||
	if err := tcget(f.Fd(), &termios); err != nil {
 | 
			
		||||
	if err := tcget(fd, &termios); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	// Set -onlcr so we don't have to deal with \r.
 | 
			
		||||
	termios.Oflag &^= unix.ONLCR
 | 
			
		||||
	return tcset(f.Fd(), &termios)
 | 
			
		||||
	if enable {
 | 
			
		||||
		// Set +onlcr so we can act like a real terminal
 | 
			
		||||
		termios.Oflag |= unix.ONLCR
 | 
			
		||||
	} else {
 | 
			
		||||
		// Set -onlcr so we don't have to deal with \r.
 | 
			
		||||
		termios.Oflag &^= unix.ONLCR
 | 
			
		||||
	}
 | 
			
		||||
	return tcset(fd, &termios)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func cfmakeraw(t unix.Termios) unix.Termios {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user