Propagate exit code in the compiler wrapper

This commit is contained in:
Andrea Fioraldi 2021-06-21 17:38:36 +02:00
parent 76892fddc6
commit abed61cc49
2 changed files with 6 additions and 5 deletions

View File

@ -17,8 +17,7 @@ fn main() {
let mut cc = ClangWrapper::new("clang", "clang++"); let mut cc = ClangWrapper::new("clang", "clang++");
cc.is_cpp(is_cpp) if let Some(code) = cc.is_cpp(is_cpp)
.silence()
.from_args(&args) .from_args(&args)
.unwrap() .unwrap()
.link_staticlib(&dir, "fuzzbench".into()) .link_staticlib(&dir, "fuzzbench".into())
@ -28,7 +27,9 @@ fn main() {
// silence the compiler wrapper output, needed for some configure scripts. // silence the compiler wrapper output, needed for some configure scripts.
.silence() .silence()
.run() .run()
.unwrap(); .unwrap() {
std::process::exit(code);
}
} else { } else {
panic!("LibAFL CC: No Arguments given"); panic!("LibAFL CC: No Arguments given");
} }

View File

@ -58,7 +58,7 @@ pub trait CompilerWrapper {
fn is_silent(&self) -> bool; fn is_silent(&self) -> bool;
/// Run the compiler /// Run the compiler
fn run(&mut self) -> Result<(), Error> { fn run(&mut self) -> Result<Option<i32>, Error> {
let args = self.command()?; let args = self.command()?;
if !self.is_silent() { if !self.is_silent() {
@ -76,7 +76,7 @@ pub trait CompilerWrapper {
if !self.is_silent() { if !self.is_silent() {
dbg!(status); dbg!(status);
} }
Ok(()) Ok(status.code())
} }
} }