pub struct ShellConnector { /* private fields */ }Expand description
A connector that executes commands via the local shell.
Uses sh -c to execute commands, providing a simple way to run
shell commands locally. Supports configurable working directory
and timeout.
§Default Configuration
| Setting | Default |
|---|---|
| Working directory | Current directory |
| Timeout | 3600 seconds (1 hour) |
§Platform Support
Requires a POSIX-compatible sh shell. Works on Linux, macOS, and
Windows with WSL or Git Bash.
Implementations§
Source§impl ShellConnector
impl ShellConnector
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new shell connector with default settings.
Uses the current working directory and a 1-hour timeout.
Sourcepub fn with_working_dir(self, dir: PathBuf) -> Self
pub fn with_working_dir(self, dir: PathBuf) -> Self
Sets the working directory for command execution.
Commands will be executed with this directory as their current working directory.
§Arguments
dir- Path to the working directory
Sourcepub fn with_timeout(self, secs: u64) -> Self
pub fn with_timeout(self, secs: u64) -> Self
Sets the command timeout in seconds.
Commands that exceed this duration will be terminated and
return a ProviderError::Timeout.
§Arguments
secs- Timeout duration in seconds
Trait Implementations§
Source§impl Connector for ShellConnector
impl Connector for ShellConnector
Source§fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 str,
) -> Pin<Box<dyn Future<Output = ProviderResult<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 str,
) -> Pin<Box<dyn Future<Output = ProviderResult<ExecResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes a command and returns the buffered result. Read more
Source§fn run_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 str,
) -> Pin<Box<dyn Future<Output = ProviderResult<OutputStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn run_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
command: &'life1 str,
) -> Pin<Box<dyn Future<Output = ProviderResult<OutputStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes a command and streams output as it occurs. Read more
Auto Trait Implementations§
impl Freeze for ShellConnector
impl RefUnwindSafe for ShellConnector
impl Send for ShellConnector
impl Sync for ShellConnector
impl Unpin for ShellConnector
impl UnsafeUnpin for ShellConnector
impl UnwindSafe for ShellConnector
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