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

View File

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