server.Server.cmd
Rust
- Python
- TypeScript
- Rust
- Go
- Java
- .NET Unavailable
- C++ Unavailable
- Swift Unavailable
- Module
- server
- Declared in
- Server
- Package
- libtmux
- Source
- crates/libtmux/src/server.rs
- Other languages
- PythonTypeScriptGoJava .NET C++ Swift
-
Execute one raw logical tmux command.
A non-zero process exit status is returned in
CommandResult. This raw boundary does not probe or enforce the supported-version floor; callers opt into that check withServer::capabilities.Errors
Returns an error when the process cannot be started, captured, awaited, or is cancelled by timeout or shutdown.
In other ports Run a tmux command this port does not model
- Python
libtmux.Server.cmd - TypeScript
server.Server.cmd - Go
tmux.Server.Cmd - Java
io.github.libtmux.Server.Server.cmd - .NET no equivalent on
Server - C++ no equivalent on
Server - Swift no equivalent on
Server
- Python
Examples
let server = libtmux::Server::builder() .socket_path("/tmp/libtmux-rs-test/command-example-absent.sock") .build()?;let result = server.cmd(libtmux::Command::new("list-sessions")).await?;assert!(result.exit_code().is_some());server.shutdown().await?;>>> server.cmd('display-message', 'hi')<libtmux.common.tmux_cmd object at ...>New session:
>>> server.cmd('new-session', '-d', '-P', '-F#{session_id}').stdout[0]'$2'>>> session.cmd('new-window', '-P').stdout[0]'libtmux...:2.0' Output of tmux -L ... new-window -P -F#{window_id} to a Window object:
>>> Window.from_window_id(window_id=session.cmd(... 'new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)Window(@4 3:..., Session($1 libtmux_...))Create a pane from a window:
>>> window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0]'%5' Output of tmux -L ... split-window -P -F#{pane_id} to a Pane object:
>>> Pane.from_pane_id(pane_id=window.cmd(... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)Pane(%... Window(@... ...:..., Session($1 libtmux_...)))await server.cmd("list-keys", ["-T", "copy-mode"]);0 declared, 0 inherited