# control.ControlSender.send

- **Module:** control.ControlSender
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/control.rs#L663
- **Page:** https://libtmux.org/reference/rs/control-controlsender-send/

```
control.ControlSender.send(self, command: Command) -> Result<BlockResult, Error>
```

Send one command and wait for its result block.

A block that tmux closed with `%error` is a result, not an error: it is
reported through [`BlockResult::succeeded`], the same way the process
API keeps a nonzero exit status as data.

The block says tmux answered the command, not that what the command
asked for has happened. Almost always those are the same moment. They
are not for the commands tmux answers at once and then parks this
client's queue behind: `wait-for <channel>` until something signals it,
and `run-shell` without `-b` for as long as its shell command runs.
Each reports success, neither has finished, and the next command sent
waits for it however long that is. Send those through
[`crate::Server::cmd`], where the wait costs one process rather than
the connection everything else on it is sharing.

Dropping this future while it is queued prevents the command from being
written. Once the connection commits it for writing, tmux may execute
it; its reply position stays reserved so later replies remain aligned.

# Errors

Returns an error when the command cannot be written as a control-mode
line, the connection has closed, or its deadline elapses while queued,
being written, or awaiting a response.
