Add check_run()

This commit is contained in:
Roey Darwish Dror
2018-12-31 22:00:34 +02:00
parent a404df9c97
commit f3f8f322d8
11 changed files with 71 additions and 215 deletions

View File

@@ -124,6 +124,13 @@ impl Executor {
Ok(result)
}
/// A convinence method for `spawn().wait().check()`.
/// Returns an error if something went wrong during the execution or if the
/// process exited with failure.
pub fn check_run(&mut self) -> Result<(), Error> {
self.spawn()?.wait()?.check()
}
}
/// A struct represending a command. Trying to execute it will just print its arguments.