pub struct TmuxCommandRunner { /* private fields */ }
Expand description
runs commands in the background via tmux on a server
Implementations§
Source§impl TmuxCommandRunner
impl TmuxCommandRunner
Sourcepub async fn new(
ssh_destination: String,
tmux_tmp_dir: String,
tmux_socket_filename: String,
tmux_session_name: TmuxSessionName,
) -> Result<Self, Error>
pub async fn new( ssh_destination: String, tmux_tmp_dir: String, tmux_socket_filename: String, tmux_session_name: TmuxSessionName, ) -> Result<Self, Error>
create a new command runner and set up necessary tmux session and options on the server side
§Errors
this fails if we can not connect to the server and create the tmux session with the required hooks and options
Sourcepub async fn run_command(
&mut self,
command: &str,
) -> Result<CommandResult, Error>
pub async fn run_command( &mut self, command: &str, ) -> Result<CommandResult, Error>
run a new command in the tmux session
§Errors
this fails on SSH errors or tmux exit status that is not success
Sourcepub async fn close(self) -> Result<(), Error>
pub async fn close(self) -> Result<(), Error>
this must be awaited at the end, when the command runner is no longer needed. If any commands are still in progress they will not be cleaned up on the server. Await all the futures for commands started on this runner before awaiting this to avoid that issue.
§Errors
this fails if we either could not send the quit signal to the background task or if the background task itself exits with an error
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TmuxCommandRunner
impl !RefUnwindSafe for TmuxCommandRunner
impl Send for TmuxCommandRunner
impl Sync for TmuxCommandRunner
impl Unpin for TmuxCommandRunner
impl !UnwindSafe for TmuxCommandRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more