pub struct CommandRunner {
pub working_dir: Option<PathBuf>,
pub env: Vec<(String, String)>,
pub inherit_env: bool,
}Expand description
A command runner that captures output and provides structured results.
Fields§
§working_dir: Option<PathBuf>Working directory for commands
env: Vec<(String, String)>Environment variables to set
inherit_env: boolWhether to inherit the parent environment
Implementations§
Source§impl CommandRunner
impl CommandRunner
Sourcepub fn with_working_dir(self, dir: impl AsRef<Path>) -> Self
pub fn with_working_dir(self, dir: impl AsRef<Path>) -> Self
Set the working directory.
Sourcepub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an environment variable.
Sourcepub fn with_ghc_bin(self, bin_dir: impl AsRef<Path>) -> Self
pub fn with_ghc_bin(self, bin_dir: impl AsRef<Path>) -> Self
Configure PATH to use a specific toolchain bin directory.
Prepends the given bin directory to PATH, ensuring tools from that directory are found first. Can be called multiple times to add multiple bin directories.
Sourcepub async fn run<S, I>(
&self,
program: S,
args: I,
) -> Result<CommandOutput, Error>
pub async fn run<S, I>( &self, program: S, args: I, ) -> Result<CommandOutput, Error>
Run a command and capture output.
Sourcepub async fn run_checked<S, I>(
&self,
program: S,
args: I,
) -> Result<CommandOutput, Error>
pub async fn run_checked<S, I>( &self, program: S, args: I, ) -> Result<CommandOutput, Error>
Run a command and return an error if it fails.
Trait Implementations§
Source§impl Clone for CommandRunner
impl Clone for CommandRunner
Source§fn clone(&self) -> CommandRunner
fn clone(&self) -> CommandRunner
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandRunner
impl Debug for CommandRunner
Source§impl Default for CommandRunner
impl Default for CommandRunner
Source§fn default() -> CommandRunner
fn default() -> CommandRunner
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CommandRunner
impl RefUnwindSafe for CommandRunner
impl Send for CommandRunner
impl Sync for CommandRunner
impl Unpin for CommandRunner
impl UnwindSafe for CommandRunner
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