On this page
libtmux.Server.run_shell
- Module
- libtmux
- Declared in
- Server
- Package
- libtmux
- Source
- src/libtmux/server.py
-
Execute a shell command via
$ tmux run-shell.Examples
>>> result = server.run_shell('true') >>> isinstance(result, list) True- Parameters
-
-
command ( str ) – Shell command to execute.
-
as_tmux_command ( bool | None ) – Parse argument as a tmux command instead of a shell command (
-Cflag). -
target_pane ( str | None ) – Target pane for output (
-tflag). -
cwd ( StrPath | None ) – Start directory for the shell command (
-cflag). When omitted, tmux uses the target client's current working directory. Requires tmux 3.4+; on older tmux a warning is emitted and the kwarg is ignored. Note: tmux's-cis a *start directory*, not subprocess semantics. Ifchdir(cwd)fails, tmux falls back to the user's home directory, then to/, rather than raising — unlike Python'ssubprocess.Popen(cwd=)which errors on a failed chdir. added 0.57 -
show_stderr ( bool | None ) – Combine the command's stderr into the captured output stream (
-Eflag, maps toJOB_SHOWSTDERR). Requires tmux 3.6+; on older tmux a warning is emitted and the kwarg is ignored. added 0.57 -
args ( list[str] | None ) – Positional arguments passed after *command*, expanded as
#{1},#{2}, … inside it. Requires tmux 3.7+; warns and is ignored on older tmux.
-
- Returns
-
list[str] | None Stdout lines, or None when *background* is True. Empty list on tmux 3.3a/3.4 (upstream stdout passthrough was broken until 3.5).
0 declared, 0 inherited