# command.CommandResult

- **Module:** command
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/command.rs#L946
- **Page:** https://libtmux.org/en/rs/latest/reference/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

- `request_id` (method): Return the Core-scoped dispatch-request identity.
- `command` (method): Return the sanitized logical command summary.
- `stdout` (method): Return stdout exactly as captured.
- `stderr` (method): Return stderr exactly as captured.
- `into_streams` (method): Consume the result and return its exact stdout and stderr buffers.
- `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): Return a named lossy UTF-8 view of stdout.
- `stderr_lossy` (method): Return a named lossy UTF-8 view of stderr.
- `success` (method): Return whether the process exited successfully.
- `refusal_for` (method): Classify a nonzero status as a refusal for a named operation.
- `exit_code` (method): Return the process exit code, or `None` when it ended by signal.
- `signal` (method): Return the terminating signal, or `None` for an ordinary exit.
