Merge pull request #1084 from johannhof/rustfmt-not-found

Show more helpful error if rustfmt is not in PATH.
This commit is contained in:
Nick Cameron 2016-07-04 21:30:52 +12:00 committed by GitHub
commit ffa5a22d1c

View File

@ -203,6 +203,16 @@ fn format_files(files: &Vec<PathBuf>,
.stdout(stdout)
.args(files)
.args(fmt_args)
.spawn());
.spawn()
.map_err(|e| {
match e.kind() {
std::io::ErrorKind::NotFound => {
std::io::Error::new(std::io::ErrorKind::Other,
"Could not run rustfmt, please make sure it is in your \
PATH.")
}
_ => e,
}
}));
command.wait()
}