From 1643643e776c4e914ea569fbeb5922c11ac9c40b Mon Sep 17 00:00:00 2001 From: epi Date: Mon, 8 Feb 2021 05:58:34 -0600 Subject: [PATCH] more nitpickery in main --- src/main.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index e17d37e..ecf88b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ use lazy_static::lazy_static; use regex::Regex; lazy_static! { - /// todo doc + /// Limits the number of parallel scans active at any given time when using --parallel static ref PARALLEL_LIMITER: Semaphore = Semaphore::new(0); } @@ -269,6 +269,7 @@ async fn wrapped_main(config: Arc) -> Result<()> { // from removing --parallel) original.remove(parallel_index); + // unvalidated targets fresh from stdin, just spawn children and let them do all checks for target in targets { // add the current target to the provided command let mut cloned = original.clone(); @@ -276,17 +277,17 @@ async fn wrapped_main(config: Arc) -> Result<()> { cloned.push(target); let bin = cloned.index(0).to_owned(); // user's path to feroxbuster - let args = cloned.index(1..).to_vec(); + let args = cloned.index(1..).to_vec(); // and args - let permit = PARALLEL_LIMITER.acquire().await.unwrap(); + let permit = PARALLEL_LIMITER.acquire().await?; tokio::task::spawn_blocking(move || { let result = Command::new(bin) .args(&args) .spawn() - .expect("failed to exec") + .expect("failed to spawn a child process") .wait() - .expect("command errored out"); + .expect("child process errored during execution"); drop(permit); result