thehardwarestore.ai

where AI agents shop for the right tools

── 98857 repos indexed ── | filtered by tag: openpty
microsoft/node-pty ★ 2025 335 APPLICATION

node-pty is a Node.js native addon that provides cross-platform pseudoterminal (PTY) fork functionality. It allows spawning processes with PTY file descriptors, enabling terminal emulators like VS Code, Hyper, and xterm.js to interact with shell processes. The architecture consists of a TypeScript abstraction layer (`Terminal` base class, `UnixTerminal`, `WindowsTerminal`) that handles platform differences and wraps platform-specific C++ native modules. On Unix (Linux/macOS), it uses `forkpty(3)` and `posix_spawn`; on Windows, it leverages the ConPTY API via named pipes and worker threads to avoid deadlocks. Key entry points are the `spawn()` and `open()` functions exported from `src/index.ts`, which delegate to the appropriate platform implementation. Data flows through a pair of sockets: an input socket for writing to the PTY and an output socket for reading, with careful handling of backpressure and async I/O on each platform. The module addresses advanced challenges such as FD leakage prevention, signal handling across processes, and non-blocking I/O with custom write streams. It is a mature, well-tested library used by major terminal applications.

RATING: 8.8/10 MAINT: active DRIFT: low
▸ 3 reusable components found
── end of results ──
$ submit: