Core LibrarystableAPI Reference

Choose documentation 3

stable

Current version

stable
English

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

function libtmux stable

raise_if_stderr

Raise LibTmuxException tagged with the tmux subcommand on stderr.

Source and package
Qualified name
libtmux.common.raise_if_stderr
Module
libtmux.common
Package
libtmux
Source
src/libtmux/common.py
raise_if_stderr (proc: tmux_cmd, subcommand: str) → None

Description#

Centralizes the if proc.stderr: raise exc.LibTmuxException(proc.stderr) pattern scattered across the wrappers. Tags the exception with the originating tmux subcommand so downstream consumers (e.g. libtmux-mcp's handle_tool_errors) keep the "which tmux command failed" context.

Examples#

>>> from libtmux.common import raise_if_stderr
>>> from libtmux import exc
>>> proc = session.cmd("display-message", "-p", "#{session_id}")
>>> raise_if_stderr(proc, "display-message") # no stderr → no raise
Parameters
Raises
Esc

Type to search.

Reference preview Open reference