pub struct CommandExecutor {
pub raw_args: Vec<String>,
pub cwd: Option<PathBuf>,
pub env: HashMap<OsString, OsString>,
pub timeout: Option<Duration>,
}Expand description
Shared machinery used by every GitCommand to spawn git.
Fields§
§raw_args: Vec<String>Raw arguments appended via the escape hatch.
cwd: Option<PathBuf>Working directory for the subprocess.
env: HashMap<OsString, OsString>Extra environment variables.
timeout: Option<Duration>Optional execution timeout.
Implementations§
Source§impl CommandExecutor
impl CommandExecutor
Sourcepub fn with_env(
self,
key: impl Into<OsString>,
value: impl Into<OsString>,
) -> Self
pub fn with_env( self, key: impl Into<OsString>, value: impl Into<OsString>, ) -> Self
Builder: set an environment variable.
Sourcepub fn add_flag(&mut self, flag: &str)
pub fn add_flag(&mut self, flag: &str)
Append a flag, normalizing to -x for single chars and --word otherwise.
Sourcepub fn add_option(&mut self, key: &str, value: &str)
pub fn add_option(&mut self, key: &str, value: &str)
Append a --key value pair (or -k value for single chars).
Sourcepub async fn execute_command(&self, args: Vec<String>) -> Result<CommandOutput>
pub async fn execute_command(&self, args: Vec<String>) -> Result<CommandOutput>
Spawn git with args followed by any raw args, returning captured output.
Non-zero exit codes become Error::CommandFailed.
Trait Implementations§
Source§impl Clone for CommandExecutor
impl Clone for CommandExecutor
Source§fn clone(&self) -> CommandExecutor
fn clone(&self) -> CommandExecutor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CommandExecutor
impl Debug for CommandExecutor
Source§impl Default for CommandExecutor
impl Default for CommandExecutor
Source§fn default() -> CommandExecutor
fn default() -> CommandExecutor
Returns the “default value” for a type. Read more
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