pub struct CommandExecutor {}Expand description
A command executor that can run shell commands
Implementations§
Source§impl CommandExecutor
impl CommandExecutor
Sourcepub fn run_command(
&self,
cmd: &str,
args: &[&str],
working_dir: Option<&Path>,
) -> Result<CommandResult, CommandError>
pub fn run_command( &self, cmd: &str, args: &[&str], working_dir: Option<&Path>, ) -> Result<CommandResult, CommandError>
Runs a command with the given arguments and optional working directory
§Arguments
cmd- The command to executeargs- Arguments to pass to the commandworking_dir- Optional working directory to run the command in
§Returns
Ok(CommandResult)- Complete command execution information if the command succeedsErr(CommandError)- A specific error describing what went wrong
§Errors
This function will return an error if:
- The working directory does not exist -
CommandError::WorkingDirectoryNotFound - The command cannot be started (e.g., command not found) -
CommandError::StartupFailed - The command execution fails with a non-zero exit code -
CommandError::ExecutionFailed
Trait Implementations§
Source§impl Debug for CommandExecutor
impl Debug for CommandExecutor
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request