# server.Server.cmd

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

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

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 with [`Server::capabilities`].

# Errors

Returns an error when the process cannot be started, captured, awaited,
or is cancelled by timeout or shutdown.

## Example

```rust
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?;
```
