Core LibraryalphaAPI Reference

Choose documentation 1

latest

Current version

latest
English

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

module libtmux-elixir latest

OneShot

Executes one explicitly selected executable with bounded captured output.

Source and package
Qualified name
LibTmux.Transport.OneShot
Module
LibTmux.Transport
Package
libtmux
Source
lib/libtmux/transport/oneshot.ex
LibTmux.Transport.OneShot

Description#

This Linux transport owns a native helper and its ordinary finite process tree. It never uses a shell. A worker owns the Port and observes caller death; the helper detects pipe closure after worker or VM death. Target environment entries travel as bytes to child execve, preserving empty values. The helper inherits the trusted host environment; requested target variables do not configure the helper. TMUX and TMUX_PANE are removed from the target environment.

Limits apply per call: stdout defaults to 1 MiB, stderr to 64 KiB, and retained chunks to 4096. max_total_bytes additionally bounds both streams together; it defaults to their summed limits. Overload returns an error with a bounded prefix. Independent caller processes require admission limits at their host or server boundary; this primitive maintains no shared request queue.

A positive timeout becomes one execution deadline. Retirement can take up to a separate 750 ms cleanup allowance after expiry. Missing retirement proof remains :unknown. No result authorizes replay. Helper SIGKILL, hostile escape and uninterruptible kernel tasks are outside the ordinary tree guarantee. Building the native helper requires a C11 compiler.

Members4#

Common operations1#

  • run/3 function Runs argv without a shell, retaining exit status separately from stdout and stderr.

Other members3#

  • option/0: option() :: {:timeout, 1..600_000} | {:deadline, LibTmux.Deadline.t()} | {:cwd, String.t()} | {:env, %{optional(binary()) => binary()}} | {:max_stdout_bytes | :max_stderr_bytes, 0..16_777_216} | {:max_total_bytes, nil | 0..33_554_432} | {:max_chunks, 1..65536} typealias Per-call input and capture limits; bytes and chunks are bounded independently.
  • result/0: result() :: %{ stdout: binary(), stderr: binary(), exit_status: non_neg_integer(), cleanup: :retired } typealias Captured bytes and child exit status after proven owned-process retirement; nonzero exit remains a transport result.
  • run!/3 function Runs argv, raising the same structured transport error on failure.
Esc

Type to search.

Reference preview Open reference