pub struct CommandBuilder { /* private fields */ }Expand description
Builder wrapper that centralizes direct usages of std::process::Command.
Implementations§
Source§impl CommandBuilder
impl CommandBuilder
pub fn new(program: impl AsRef<OsStr>) -> Self
pub fn arg(&mut self, arg: impl AsRef<OsStr>) -> &mut Self
pub fn args<S, I>(&mut self, args: I) -> &mut Self
pub fn env( &mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>, ) -> &mut Self
pub fn env_remove(&mut self, key: impl AsRef<OsStr>) -> &mut Self
pub fn stdin_file(&mut self, file: File) -> &mut Self
pub fn stdin_piped(&mut self) -> &mut Self
pub fn stdout_piped(&mut self) -> &mut Self
pub fn stderr_piped(&mut self) -> &mut Self
pub fn current_dir(&mut self, dir: impl AsRef<Path>) -> &mut Self
pub fn status(&mut self) -> Result<ExitStatus>
pub fn output(&mut self) -> Result<CommandOutput>
pub fn spawn(&mut self) -> Result<ChildHandle>
Sourcepub fn spawn_piped(&mut self) -> Result<PipedChild>
pub fn spawn_piped(&mut self) -> Result<PipedChild>
Spawn with piped stdio halves handed back for frame pumps: stdin and
stdout are forced to pipes (stderr keeps whatever was configured,
usually inherited for diagnostics). The remaining child is wrapped
in a ChildHandle so kill-on-drop and reaping behave identically
to spawn. Sessions own the halves and join their
pump threads; dropping the halves closes the pipes.
Sourcepub fn snapshot(&self) -> CommandSnapshot
pub fn snapshot(&self) -> CommandSnapshot
Return a lightweight snapshot of the command configuration for testing.
Auto Trait Implementations§
impl !RefUnwindSafe for CommandBuilder
impl !UnwindSafe for CommandBuilder
impl Freeze for CommandBuilder
impl Send for CommandBuilder
impl Sync for CommandBuilder
impl Unpin for CommandBuilder
impl UnsafeUnpin for CommandBuilder
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