Server.Cmd
Cmd executes raw tmux arguments and returns caller-owned result slices. A completed nonzero exit remains a result; validation and transport failures return errors. Cancellation cannot prove whether a mutation reached tmux.
Source and package
- Qualified name
-
tmux.Server. Cmd - Package
- tmux
- Declared in
Server- Distribution
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/server.go
- Other languages
- Perlmethod Erlangfunction PowerShell Julia Elixirfunction Haskell Common Lisp PythonRubyLuaTypeScriptRustJava C# C++ Swift Kotlin Scala OCaml F# Clojure
- func (s Server) Cmd( ctx context
.Context , args ...string, ) (CommandResult , error) -
Description#
An argument that is exactly ";" separates two tmux commands, so one call can submit a command list. tmux runs a list until a command fails and drops the rest, and answers with one merged stdout, so a caller that needs to know which command produced which line submits them separately. A list means the same thing through either execution binding.
Standalone -V and -h diagnose the configured executable without daemon version checks. They do not qualify a later daemon operation.
A standalone ";" separates commands across bindings. The subprocess path also follows tmux's trailing-semicolon and escaping rules; typed operations keep values literal across bindings.
On a
Connection-bound server Cmd uses a lane, and tmux cannot cancel a command already sent, so a command that waits on something outside tmux, such as wait-for or a foreground run-shell, holds that lane until it finishes even after ctx ends.Server.WaitFor,Server.RunShell, andServer.IfShelltake a client of their own instead.
In other ports#
Run a tmux command this port does not model
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Ruby | Lib |
| Lua | libtmux |
| Erlang | tmux Executes an explicit command value with bounded output and separate outcome and cleanup evidence. |
| Elixir | Lib Runs one trusted Command without attaching a client and returns bounded output with exit evidence. |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | server |
| Rust | server |
| Java | io |
| C# | no equivalent on Server |
| C++ | no equivalent on Server |
| Swift | no equivalent on Server |
| OCaml | No direct public OCaml equivalent is recorded for this operation. |
| Perl | Lib Checked literal argument vector; no shell wrapper or implicit tmux command list. |
No equivalent is recorded in PowerShell, Julia, Common Lisp, Clojure, Kotlin, Scala or F#.