Core LibraryunreleasedAPI Reference

Choose documentation 1

latest

Current version

latest
English

Unreleased libtmux_erlang has not been released. Its API may change during development. This site's structure and URLs may change too.

function libtmux-erlang latest

tmux_server:with_server/2

Open a borrowed endpoint, run a callback in the calling process, then close it. Performs the same I/O as open/1 and close/1; the borrowed daemon survives. Startup failure passes through without invoking the callback.

Source and package
Qualified name
tmux_server:with_server/2
Declared in
tmux_server
Package
libtmux_erlang
Source
apps/libtmux_erlang/src/tmux_server.erl
with_server(Options, Function) -spec with_server(open_options(), fun((t()) -> Value)) -> {ok, Value} | {error, scope_failure() | map()}.

Description#

With successful cleanup, returns {ok, Value} for any callback return value, including a returned error tuple. Callback error, throw and exit exceptions are re-raised with their original reason and stack. If cleanup fails, returns {error, Failure} with scope_failure/0, preserving both outcomes and the endpoint for explicit recovery. It attempts cleanup once; a timeout does not prove retirement. Existing supervised cleanup ownership remains in force.

The callback must retire separately created resources such as tmux_control attachments. This scope closes its endpoint, not every resource the callback may allocate. Use with_owned/2 when the scope should own the daemon too.

Parameters

Guides#

Pages that discuss with_server/2.

Esc

Type to search.

Reference previewOpen reference