Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotAConsole = errors.New("provided file is not a console") ErrNotImplemented = errors.New("not implemented") )
Functions ¶
func ClearONLCR ¶
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.
Types ¶
type Console ¶
type Console interface {
File
// Resize resizes the console to the provided window size
Resize(WinSize) error
// ResizeFrom resizes the calling console to the size of the
// provided console
ResizeFrom(Console) error
// SetRaw sets the console in raw mode
SetRaw() error
// DisableEcho disables echo on the console
DisableEcho() error
// Reset restores the console to its original state
Reset() error
// Size returns the window size of the console
Size() (WinSize, error)
}
func ConsoleFromFile ¶
ConsoleFromFile returns a console using the provided file nolint:revive
func NewPty ¶
NewPty creates a new pty pair The master is returned as the first console and a string with the path to the pty slave is returned as the second
func NewPtyFromFile ¶ added in v1.0.5
NewPtyFromFile creates a new pty pair, just like NewPty except that the provided os.File is used as the master rather than automatically creating a new master from /dev/ptmx. The ownership of os.File is passed to the returned Console, so the caller must be careful to not call Close on the underlying file.