Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

libtmux::Server::wait_for

C++

View as Markdown

Module
libtmux
Declared in
Server
Package
libtmux-cxx
Source
include/libtmux/server.hpp
Other languages
PythonRuby Lua TypeScript RustGo Java .NETSwift
wait_for ( channel : std::string_view , timeout : std::optional< std::chrono::milliseconds > = {} ) → expected< void, CommandFailure >
methodreadonly [source]
methodreadonly [source]
wait_for

Block until someone signals this channel, or the deadline passes.

tmux latches a signal: one sent while nobody is waiting satisfies the next wait rather than being lost. That makes signal-before-wait safe, and it also means a stale signal can release a later waiter, so a channel is worth naming for one exchange rather than reusing.

A server that dies under a waiter makes tmux exit zero, which is indistinguishable from being signalled — a caller would carry on as though the other side had spoken. This reports that as a failure instead, which is the reason to prefer it over running the command.

Omitting timeout waits with no deadline: if the channel is never signalled, this call never returns. Waiting is the whole point of the request, so that is deliberate rather than a gap — pass a timeout to bound it.

Discussed in Capture pane output · Capturing output · Waiting and retrying

In other ports Wait for, signal or lock a channel

0 declared, 0 inherited

Esc

Type to search.