Core Library0.xAPI reference

Choose documentation 1

pr-173

Current version

pr-173
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

function libtmux-elixir

Control.with_connection/2

Runs a callback with one connection and owns its native and supervisor cleanup.

Source and package
Qualified name
LibTmux.Control.with_connection/2
Module
LibTmux
Declared in
Control
Package
libtmux
Source
lib/libtmux/control.ex
with_connection(options, callback) @spec with_connection([scope_option()], (t() -> value)) :: {:ok, value} | {:error, LibTmux.Error.t() | LibTmux.Control.ScopeFailure.t(value)} when value: var

Description

Takes the explicit server, existing session and host qualification options from start_link/1. The callback runs in the calling process. Its duration is separate from startup and cleanup_timeout (default 950ms). A dedicated connection owner also requests cleanup when that caller dies.

Returns {:ok, value} after proven connection retirement and Root exit. Cleaned-up exceptions, throws and exits are re-raised with their original stacktrace. If cleanup fails, returns {:error, ScopeFailure} containing the callback's original value or exception and separate cleanup evidence. Startup failures return {:error, Error}; invalid options raise.

The control handle is scoped to the callback. Explicit reconnect is allowed inside it; cleanup permanently fences new epochs and retires the current one. Escaped handles cannot reconnect after the scope. Startup retains start_link/1's OTP initialization limitation; a timeout can report unknown cleanup while its owner is still unwinding startup. It does not promise a hard native process-exit deadline.

alias LibTmux.Control

Control.with_connection(options, fn control -> Control.execute(control, LibTmux.Control.Request.field("pid")) end)

Type parameters
Parameters

Recorded calls

source calls
No call edges in the Elixir model.

The Elixir reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls LibTmux.Control.with_connection/2.

Guides

task material

Pages that discuss with_connection/2.

Esc
Search in

Type to search.

Reference previewOpen reference