add the error mapping
This commit is contained in:
parent
8a04ec6ec7
commit
3759a6695d
1 changed files with 8 additions and 1 deletions
|
|
@ -127,7 +127,14 @@ fn get_version() -> Result<i32, io::Error> {
|
|||
let mut command = Command::new("rustfmt")
|
||||
.stdout(std::process::Stdio::inherit())
|
||||
.args(&[String::from("--version")])
|
||||
.spawn()?;
|
||||
.spawn()
|
||||
.map_err(|e| match e.kind() {
|
||||
io::ErrorKind::NotFound => io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Could not run rustfmt, please make sure it is in your PATH.",
|
||||
),
|
||||
_ => e,
|
||||
})?;
|
||||
status.push(command.wait()?);
|
||||
|
||||
Ok(status
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue