Core Library0.xTopics

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

Ownership and cleanup

Needs libtmux for C++ 0.x Install

A tmux session, window, or pane normally remains until you kill it. Scope-based cleanup can kill it when your code leaves a block, including after an exception. See Workspaces for a temporary layout example.

Owning a test server

C++‘s Session, Window, and Pane are non-owning values; destroying a handle does not kill its tmux object. libtmux::test::ScopedTmuxServer, in the separate testing CMake component, owns a private test server and its temporary socket directory:

auto fixture = libtmux::test::ScopedTmuxServer::start(
{.socket_namespace = libtmux::test::SocketNamespace::consumer("my-suite")});
// fixture killed, and its tree removed, when this scope ends:
// even if the test that follows fails

Testing cleanup

Use explicit cleanup for objects whose handles have no disposal hook. For an entire disposable test server, prefer your port’s test fixture or server guard; see Testing with libtmux.

Esc
Search in

Type to search.

Reference previewOpen reference