testpty

package
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package testpty gives tests a stand-in for a tmux attach client's PTY. A real client's PTY stays open, its reads blocking, until the session ends; /dev/null or a regular file reads EOF at once, which a client takes for a session that died. Pair's attach end blocks until the test closes its peer, and it is pollable, so a deadline or Close interrupts a blocked read and releasing a client stays fast.

Only test code imports this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pair

func Pair(t testing.TB) (attach, peer *os.File)

Pair returns a connected, bidirectional pair: attach stands in for the PTY a client reads its session's output from and writes keys to, and closing peer is what the session ending does to it (reads return EOF). attach is non-blocking, so os.NewFile registers it with the runtime poller. Both ends are closed when t finishes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL