Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

ControlSender.send

Send one command and wait for its result block.

Source and package
Qualified name
libtmux::control::ControlSender::send
Module
control
Declared in
ControlSender
Package
libtmux
Source
crates/libtmux/src/control.rs
pub async fn send(&self, command: Command) -> Result< BlockResult, Error >

Description#

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.

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.

Cancel safety

A command dropped while queued is never written. Once the connection has committed it, tmux may run it, and its reply is still read and discarded, so later replies stay aligned.

Parameters

Guides#

Pages that discuss send.

Esc

Type to search.

Reference previewOpen reference