multiclienttmux

package
v1.9.21 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package multiclienttmux boots an isolated tmux server with aggressive-resize=on and lets a test attach N pty clients at chosen sizes — the harness from TEST-PLAN.md §6.1 / TUI-TEST-PLAN.md §6.8 for the "two web clients hijacking pane size" regression (J4 / F2).

Every harness instance gets its own socket under t.TempDir(), never touching the user's real tmux server. Cleanup tears down the server, kills all spawned client processes, and removes the socket.

Usage:

h := multiclienttmux.New(t, "myscratch")
h.AddClient(80, 24)
h.AddClient(120, 40)
w, hgt, _ := h.WindowSize() // expect 120x40 (largest)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Harness

type Harness struct {
	SocketPath  string // -S <path> for every tmux command targeting this server
	SessionName string
	// contains filtered or unexported fields
}

Harness is the live test scaffold.

func New

func New(t *testing.T, sessionName string) *Harness

New boots a fresh tmux server on a per-test isolated socket and creates a detached session named sessionName with aggressive-resize=on. The server and all spawned clients are torn down via t.Cleanup.

Skips the test (via t.Skip) if the tmux binary is unavailable.

func (*Harness) AddClient

func (h *Harness) AddClient(cols, rows int) error

AddClient spawns a pty-backed `tmux attach` client at the requested size. The pty stays alive (and the client attached) until cleanup.

func (*Harness) ClientCount

func (h *Harness) ClientCount() (int, error)

ClientCount returns the number of currently attached clients per tmux.

func (*Harness) WindowSize

func (h *Harness) WindowSize() (int, int, error)

WindowSize returns the active window's dimensions as tmux currently reports them (`tmux display -p '#{window_width}x#{window_height}'`).

Jump to

Keyboard shortcuts

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