Only print errors if the programs failed

This commit is contained in:
greg 2017-01-18 03:21:09 -08:00
parent 751c6f65bd
commit eb6354e55a

View File

@ -33,15 +33,20 @@ pub fn compilation_sequence(ast: AST, sourcefile: &str) {
.output() .output()
.expect("Failed to run llc"); .expect("Failed to run llc");
if !llc_output.status.success() {
println!("{}", String::from_utf8_lossy(&llc_output.stderr)); println!("{}", String::from_utf8_lossy(&llc_output.stderr));
}
let gcc_output = Command::new("gcc") let gcc_output = Command::new("gcc")
.args(&["-o", bin_filename, &obj_filename]) .args(&["-o", bin_filename, &obj_filename])
.output() .output()
.expect("failed to run gcc"); .expect("failed to run gcc");
if !gcc_output.status.success() {
println!("{}", String::from_utf8_lossy(&gcc_output.stdout)); println!("{}", String::from_utf8_lossy(&gcc_output.stdout));
println!("{}", String::from_utf8_lossy(&gcc_output.stderr)); println!("{}", String::from_utf8_lossy(&gcc_output.stderr));
}
for filename in [obj_filename].iter() { for filename in [obj_filename].iter() {
Command::new("rm") Command::new("rm")