Skip to content

Commit

Permalink
create ctrl-c channel only if fuzzin
Browse files Browse the repository at this point in the history
  • Loading branch information
R9295 committed Jun 20, 2024
1 parent d34df09 commit 0ec6442
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bin/cargo-ziggy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,14 @@ fn main() -> Result<(), anyhow::Error> {

env_logger::init();
let Cargo::Ziggy(command) = Cargo::parse();
let (tx, rx) = channel();
ctrlc::set_handler(move || tx.send(()).expect("Could not send signal on channel."))
.expect("Error setting Ctrl-C handler");
match command {
Ziggy::Build(args) => args.build().context("Failed to build the fuzzers"),
Ziggy::Fuzz(mut args) => args.fuzz(rx).context("Failure running fuzzers"),
Ziggy::Fuzz(mut args) => {
let (tx, rx) = channel();
ctrlc::set_handler(move || tx.send(()).expect("Could not send signal on channel."))
.expect("Error setting Ctrl-C handler");
args.fuzz(rx).context("Failure running fuzzers")
}
Ziggy::Run(mut args) => args.run().context("Failure running inputs"),
Ziggy::Minimize(mut args) => args.minimize().context("Failure running minimization"),
Ziggy::Cover(mut args) => args
Expand Down

0 comments on commit 0ec6442

Please sign in to comment.