# pane.Pane.cmd

- **Module:** pane.Pane
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/pane.rs#L711
- **Page:** https://libtmux.org/reference/rs/pane-pane-cmd/

```
pane.Pane.cmd(self, command: Command) -> Result<CommandResult, Error>
```

Run a raw tmux command against this pane.

The escape hatch for anything this crate does not wrap. `-t` is 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 [`CommandResult`] rather than
as an error, the same as [`crate::Server::cmd`].

# Errors

Returns an error when the process cannot be started, captured, or
awaited.

## Example

```rust
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("raw").await?;
let window = session.active_window().await?.expect("a window");
let pane = window.active_pane().await?.expect("a pane");

let result = pane
    .cmd(libtmux::Command::new("display-message").arg("-p").arg("#{pane_id}"))
    .await?;
assert_eq!(result.stdout_lossy().trim(), pane.id().to_string());

guard.shutdown().await?;
```
