Core Library0.xGuides

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

MoreLess about this notice
Edit this page on GitHub

Capturing output

Needs libtmux for Rust 0.x Install

Pane::capture reads the visible screen. The complete program compares the returned line bytes with the expected output and uses tokio::time::timeout to bound the task. It kills its private server and shuts down the client before returning a capture error.

Run the complete program

Capture pane output includes the full Rust program, all imports, project files and a run command. The program matches libtmux capture ready as a complete line, so the echoed command cannot satisfy the check. It creates and cleans up its own tmux server.

Visible pane vs. scrollback

A capture reads terminal state. Lines that have scrolled beyond retained history are unavailable, and repeated captures can miss intermediate output. Choose the range your task needs and use a stream or completion signal when every output event matters.

Wait for the expected text

Use a deadline and a specific output predicate. The example’s short polling pause limits work between checks; it is the observed line that determines completion. Sending keys explains why returning from the input call is not a completion signal.

Wait for a completion signal

A program can also signal a dedicated tmux channel. Use the same server endpoint for the sender and waiter and a new channel name per task. Waiting and retrying documents this port’s waiting APIs and failure handling.

Esc
Search in

Type to search.

Reference previewOpen reference