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

module libtmux-elixir

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 unless keep_tmux_context: true, which LibTmux.Server.run/3 passes only for a Server that chose no socket.

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 members

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()}} | {:native_helper, Path.t() | nil} | {:keep_tmux_context, boolean()} | {: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
Search in

Type to search.

Reference previewOpen reference