fix(build): Remove debug println! (#287)
This commit is contained in:
+19
-8
@@ -66,11 +66,13 @@ pub mod prost;
|
|||||||
pub mod schema;
|
pub mod schema;
|
||||||
|
|
||||||
#[cfg(feature = "rustfmt")]
|
#[cfg(feature = "rustfmt")]
|
||||||
use std::process::Command;
|
use std::io::{self, Write};
|
||||||
|
#[cfg(feature = "rustfmt")]
|
||||||
|
use std::process::{exit, Command};
|
||||||
|
|
||||||
/// Serivce code generation for client
|
/// Service code generation for client
|
||||||
pub mod client;
|
pub mod client;
|
||||||
/// Serivce code generation for Server
|
/// Service code generation for Server
|
||||||
pub mod server;
|
pub mod server;
|
||||||
|
|
||||||
/// Format files under the out_dir with rustfmt
|
/// Format files under the out_dir with rustfmt
|
||||||
@@ -83,17 +85,26 @@ pub fn fmt(out_dir: &str) {
|
|||||||
if !file.ends_with(".rs") {
|
if !file.ends_with(".rs") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let out = Command::new("rustfmt")
|
let result = Command::new("rustfmt")
|
||||||
.arg("--emit")
|
.arg("--emit")
|
||||||
.arg("files")
|
.arg("files")
|
||||||
.arg("--edition")
|
.arg("--edition")
|
||||||
.arg("2018")
|
.arg("2018")
|
||||||
.arg(format!("{}/{}", out_dir, file))
|
.arg(format!("{}/{}", out_dir, file))
|
||||||
.output()
|
.output();
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
println!("out: {:?}", out);
|
match result {
|
||||||
assert!(out.status.success());
|
Err(e) => {
|
||||||
|
eprintln!("error running rustfmt: {:?}", e);
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
|
Ok(output) => {
|
||||||
|
if !output.status.success() {
|
||||||
|
io::stderr().write_all(&output.stderr).unwrap();
|
||||||
|
exit(output.status.code().unwrap_or(1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user