$ show containerd/console
This is a Go library for console and terminal handling, part of the containerd project. It provides a cross-platform `Console` interface with methods for setting raw mode, resizing, disabling echo, and querying window size. The library supports Linux, macOS, FreeBSD, NetBSD, OpenBSD, Windows, and z/OS via build tags. On Linux, it includes an `Epoller` that uses edge-triggered epoll for efficient non-blocking I/O, handling EAGAIN/EIO errors gracefully. It can create PTY pairs (`NewPty`) and obtain the current process console (`Current`). The only external dependency is `golang.org/x/sys`. The code is idiomatic, well-tested, and follows Go best practices, though the dependency version and CI Go version are outdated.
The LLM identified 1 files worth highlighting for reuse:
Implements an Epoller that uses Linux epoll with edge-triggered notifications for efficient I/O on console file descriptors. It handles EAGAIN/EIO errors by waiting for epoll events, uses sync.Cond for signaling, and provides a clean API for adding consoles, waiting for events, and shutting down. This component is self-contained and could be extracted for any non-blocking I/O on file descriptors.