Core LibraryunreleasedAPI reference

Choose documentation 2

latest

Current version

latest
English

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

MoreLess about this notice

function libtmux-ocaml

Libtmux_eio.with_private_daemon

Run f against a tmux daemon this call starts and owns, then stop it. The daemon listens on a socket in a fresh directory, created mode 0700 under root (default: the system temporary directory) and named with the prefix libtmux-ocaml-. It reads config_file, or nothing when none is given, instead of any default configuration. Neither TMUX nor TMUX_PANE reaches it. A root whose socket path would exceed the 107 bytes of a Unix socket address returns Libtmux.Error.Invalid_input before anything is created.

Source and package
Qualified name
Libtmux_eio.with_private_daemon
Declared in
Libtmux_eio
Package
libtmux-eio
Source
eio/libtmux_eio.mli
val with_private_daemon : ?cleanup:Cleanup.t -> ?binary:string -> ?config_file:string -> ?root:string -> ?session:string -> ?timeout:float -> process_mgr:[> [> `Generic ] Eio.Process.mgr_ty ] Eio.Process.mgr -> mono_clock:[> Eio.Time.Mono.ty ] Eio.Time.Mono.t -> (Libtmux.Endpoint.t -> 'a) -> ('a, Libtmux.Error.t) result

Public owner: Libtmux_eio

Description

f receives the Libtmux.Endpoint.t once the socket answers, within timeout seconds (default 5). The daemon stays alive until it is stopped, even with no session. Client.connect needs a session to attach to, so pass session to start the daemon with one detached session of that name, with a single window named main running /bin/cat -u, or create the first session with Workspace.submit_bootstrap. Close every client made for endpoint before f returns.

On every exit of f, including an exception or Eio cancellation, the daemon is terminated and reaped, the call checks that nothing answers the socket, and the directory is removed. An exception from f propagates after cleanup, and a cleanup failure never replaces it; failures are retained in cleanup. When f returns, a cleanup failure is the result. A daemon that still answers, or one that cannot be reaped, leaves the directory in place and returns Libtmux.Error.Filesystem or the cleanup error with its path. Normal return gives Ok of the value of f. The helper runs f in its own switch. The daemon's child process and cleanup are not cancellable: cancellation of the calling fiber waits for the daemon's termination before it propagates.

Parameters

Recorded calls

source calls
No call edges in the OCaml model.

The OCaml 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_eio.with_private_daemon.

Guides

task material

Pages that discuss with_private_daemon.

Esc
Search in

Type to search.

Reference previewOpen reference