# command.CommandResult

- **Module:** command
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/command.rs#L833
- **Page:** https://libtmux.org/reference/rs/command-commandresult/

The exact status and output captured for one tmux command.

A non-zero exit status is returned as data. Output bytes are never trimmed,
decoded, or mirrored between streams.

## Example

```rust
use libtmux::Command;

let guard = libtmux::test::TestServer::new().await?;
guard.server().new_session("work").await?;

let result = guard
    .server()
    .cmd(Command::new("list-sessions").arg("-F").arg("#{session_name}"))
    .await?;

// The exact bytes tmux emitted are kept until a caller asks for text, because
// a session name need not be UTF-8.
assert_eq!(result.stdout(), b"work\n");
assert_eq!(result.stdout_utf8()?, "work\n");

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

## Members

- `new` (method)
- `request_id` (method)
- `command` (method)
- `stdout` (method)
- `stderr` (method)
- `into_streams` (method)
- `stdout_utf8` (method) — Borrow stdout as UTF-8 without copying or replacement.
- `stderr_utf8` (method) — Borrow stderr as UTF-8 without copying or replacement.
- `stdout_lossy` (method)
- `stderr_lossy` (method)
- `success` (method)
- `refusal_for` (method)
- `exit_code` (method)
- `signal` (method)
