pub struct Command { /* private fields */ }
Expand description
A command wrapper that simplifies interaction with external commands.
Implementations§
source§impl Command
impl Command
sourcepub fn args<I>(&mut self, args: I)where
I: IntoIterator,
I::Item: AsRef<OsStr>,
pub fn args<I>(&mut self, args: I)where I: IntoIterator, I::Item: AsRef<OsStr>,
Push a collection of arguments to the command.
sourcepub fn working_directory(&mut self, path: impl AsRef<Path>)
pub fn working_directory(&mut self, path: impl AsRef<Path>)
Configure the working directory of this command.
sourcepub fn run_lines(self) -> Result<Vec<String>, Error>
pub fn run_lines(self) -> Result<Vec<String>, Error>
Run the given command, return all lines printed to stdout on success.
sourcepub fn run_stdout(self) -> Result<String, Error>
pub fn run_stdout(self) -> Result<String, Error>
Run the given command, return a string of all output.
sourcepub fn run_checked(self) -> Result<(), Error>
pub fn run_checked(self) -> Result<(), Error>
Run the given command, only checking for status code and providing diagnostics.
sourcepub fn run_inherited(&self) -> Result<(), Error>
pub fn run_inherited(&self) -> Result<(), Error>
Run the given command, inheriting stdout, stderr from the current process.
This is discouraged, since it basically requires the command to be running on the main thread.
sourcepub fn status(self) -> Result<ExitStatus>
pub fn status(self) -> Result<ExitStatus>
Run the command and wait for exit status.