pub struct CommandExecutor { /* private fields */ }Expand description
Command executor for running commands in shell sessions.
Implementations§
Source§impl CommandExecutor
impl CommandExecutor
Sourcepub fn new(store: Arc<SessionStore>) -> Self
pub fn new(store: Arc<SessionStore>) -> Self
Create a new command executor.
Sourcepub fn execute_sync(&self, command: &Command) -> Result<ExecutionResult>
pub fn execute_sync(&self, command: &Command) -> Result<ExecutionResult>
Execute a command synchronously (blocking).
This runs the command and waits for completion or timeout. Prefer
CommandExecutor::execute from async contexts — this blocking variant
must never be called directly on a tokio worker thread.
Sourcepub async fn execute(&self, command: &Command) -> Result<ExecutionResult>
pub async fn execute(&self, command: &Command) -> Result<ExecutionResult>
Execute a command, keeping the async runtime responsive.
The blocking work runs on a dedicated blocking thread via
spawn_blocking, so the tokio worker pool (and therefore /health and
the accept loop) is never starved by a slow or hung command. The
underlying [run_command] enforces its own timeout, so this always
completes without leaking runtime capacity.
Sourcepub async fn execute_async(
&self,
command: &Command,
) -> Result<(Receiver<OutputChunk>, JoinHandle<Result<ExecutionResult>>)>
pub async fn execute_async( &self, command: &Command, ) -> Result<(Receiver<OutputChunk>, JoinHandle<Result<ExecutionResult>>)>
Execute a command asynchronously, streaming output chunks as they arrive.
Returns a receiver that yields OutputChunks live, plus a join handle
resolving to the final ExecutionResult. Backed by the same piped
[run_command_streaming] core as the non-streaming paths, so it inherits
real completion detection, enforceable timeout, and process-tree kill —
none of which the previous PTY implementation could provide for
non-interactive commands (see [run_command_streaming]).
Sourcepub async fn execute_in_session(
&self,
session_id: &SessionId,
command: &Command,
) -> Result<ExecutionResult>
pub async fn execute_in_session( &self, session_id: &SessionId, command: &Command, ) -> Result<ExecutionResult>
Execute a command in an existing session.
Auto Trait Implementations§
impl Freeze for CommandExecutor
impl RefUnwindSafe for CommandExecutor
impl Send for CommandExecutor
impl Sync for CommandExecutor
impl Unpin for CommandExecutor
impl UnsafeUnpin for CommandExecutor
impl UnwindSafe for CommandExecutor
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.