Session.cmd
Run a raw tmux command against this session.
Source and package
- Qualified name
-
libtmux::session:: Session:: cmd - Module
- session
- Declared in
Session- Package
- libtmux
- Source
- crates/libtmux/src/session.rs
- Other languages
- Perl Erlang PowerShell Julia Elixir Haskell Common Lisp Python Ruby Lua TypeScriptGo Java C# C++ Swift Kotlin Scala OCaml F# Clojure
-
Description#
The escape hatch for anything this crate does not wrap.
-tis placed after the subcommand for you, because tmux stops reading flags at the first positional: a target appended after one is taken as text, and the command then succeeds having acted on something else.A non-zero exit status comes back in the
CommandResultrather than as an error, the same ascrate::Server::cmd().Errors
Returns an error when the process cannot be started, captured, or awaited.
Examples#
let guard = libtmux::test::TestServer::new().await?;let session = guard.server().new_session("raw").await?;let result = session.cmd(libtmux::Command::new("display-message").arg("-p").arg("#{session_name}")).await?;assert_eq!(result.stdout_lossy().trim(), "raw");guard.shutdown().await?;
In other ports#
Run a tmux command addressed at a session
| Language | Equivalent |
|---|---|
| Python | libtmux |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | session |
| Go | tmux |
| Java | no equivalent on Session |
| C# | no equivalent on Session |
| C++ | no equivalent on Session |
| Swift | no equivalent on Session |
| OCaml | No direct public OCaml equivalent is recorded for this operation. |
| Perl | No dedicated equivalent in the selected Perl surface. Explicit Server::cmd remains available for native tmux commands. |
No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.