On this page
libtmux.common.raise_if_stderr
- Module
- libtmux.common
- Package
- libtmux
- Source
- src/libtmux/common.py
-
Raise
LibTmuxExceptiontagged with the tmux subcommand on stderr.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'shandle_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
-
-
proc ( tmux_cmd ) – Result of a
Server.cmd/Session.cmd/ etc. call. -
subcommand ( str ) – The tmux subcommand the wrapper invoked, e.g.
"last-window","swap-pane". Surfaces instr(exc)as a"<subcommand>: …"prefix.
-
- Raises
-
-
LibTmuxException – When
proc.stderris non-empty.
-
0 declared, 0 inherited