build: show all rustfmt output on errors (#621)

Sometimes error output from rustfmt might be printed to stdout instead
of stderr. So to help users debug rustfmt issues this makes stdout get
printed as well.

Fixes https://github.com/hyperium/tonic/issues/600
This commit is contained in:
David Pedersen
2021-05-08 16:11:03 +02:00
committed by GitHub
parent 8cfa44110c
commit c39404d720
+1
View File
@@ -182,6 +182,7 @@ pub fn fmt(out_dir: &str) {
}
Ok(output) => {
if !output.status.success() {
io::stdout().write_all(&output.stdout).unwrap();
io::stderr().write_all(&output.stderr).unwrap();
exit(output.status.code().unwrap_or(1))
}