package console
import "github.com/containerd/console"
Index ¶
- Variables
- func ClearONLCR(fd uintptr) error
- func SetONLCR(fd uintptr) error
- type Console
- func ConsoleFromFile(f File) (Console, error)
- func Current() (c Console)
- func NewPty() (Console, string, error)
- type File
- type WinSize
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.
func SetONLCR ¶
SetONLCR sets the necessary tty_ioctl(4)s to ensure that a pty pair created by us acts as intended for a terminal emulator.
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 Current ¶
func Current() (c Console)
Current returns the current process' console
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
type File ¶
type File interface { io.ReadWriteCloser // Fd returns its file descriptor Fd() uintptr // Name returns its file name Name() string }
type WinSize ¶
type WinSize struct { // Height of the console Height uint16 // Width of the console Width uint16 // contains filtered or unexported fields }
WinSize specifies the window size of the console
Source Files ¶
console.go console_unix.go pty_unix.go tc_darwin.go tc_unix.go
- Version
- v1.0.4 (latest)
- Published
- Jul 6, 2023
- Platform
- darwin/amd64
- Imports
- 5 packages
- Last checked
- 6 days ago –
Tools for package owners.