Skip to content

Commit

Permalink
Fix a bug causing incorrect exit codes to be produced
Browse files Browse the repository at this point in the history
  • Loading branch information
smoelius committed May 10, 2024
1 parent f77e2c7 commit 3ab762f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions cargo-test-fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ pub fn run(opts: TestFuzz) -> Result<()> {
opts
};

run_without_exit_code(&opts).map_err(|error| {
if opts.exit_code {
eprintln!("{error:?}");
exit(2);
}
error
})
}

pub fn run_without_exit_code(opts: &TestFuzz) -> Result<()> {
if let Some(object) = opts.replay {
ensure!(
!matches!(object, Object::ImplGenericArgs | Object::GenericArgs),
Expand Down Expand Up @@ -223,13 +233,7 @@ pub fn run(opts: TestFuzz) -> Result<()> {

let executable_targets = flatten_executable_targets(&opts, executable_targets)?;

fuzz(&opts, &executable_targets).map_err(|error| {
if opts.exit_code {
eprintln!("{error:?}");
exit(2);
}
error
})
fuzz(&opts, &executable_targets)
}

fn build(opts: &TestFuzz, quiet: bool) -> Result<Vec<Executable>> {
Expand Down

0 comments on commit 3ab762f

Please sign in to comment.