diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index aca1087..5a94b56 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,6 +23,10 @@ jobs: RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort' RUSTDOCFLAGS: '-Cpanic=abort' - uses: actions-rs/grcov@v0.1 + - uses: actions/upload-artifact@v2 + with: + name: lcov.info + path: lcov.info - name: Convert lcov to xml run: | curl -O https://raw.githubusercontent.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py @@ -34,3 +38,7 @@ jobs: file: ./coverage.xml name: codecov-umbrella fail_ci_if_error: true + - uses: actions/upload-artifact@v2 + with: + name: coverage.xml + path: ./coverage.xml diff --git a/src/event_handlers/outputs.rs b/src/event_handlers/outputs.rs index 97db2f9..fd16522 100644 --- a/src/event_handlers/outputs.rs +++ b/src/event_handlers/outputs.rs @@ -40,6 +40,11 @@ impl TermOutHandle { pub async fn sync(&self) -> Result<()> { let (tx, rx) = oneshot::channel::(); self.send(Command::Sync(tx))?; + if !CONFIGURATION.output.is_empty() { + let (tx, rx) = oneshot::channel::(); + self.tx_file.send(Command::Sync(tx))?; + rx.await?; + } rx.await?; Ok(()) } @@ -84,6 +89,9 @@ impl FileOutHandler { log::error!("file handler got Exit"); break; } + Command::Sync(sender) => { + sender.send(true).unwrap_or_default(); + } _ => {} // no more needed } } diff --git a/src/main.rs b/src/main.rs index 56f4957..2cafc78 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,6 @@ use futures::StreamExt; use tokio::{io, sync::oneshot}; use tokio_util::codec::{FramedRead, LinesCodec}; -use feroxbuster::event_handlers::Command; use feroxbuster::{ banner::{Banner, UPDATE_URL}, config::{CONFIGURATION, PROGRESS_BAR, PROGRESS_PRINTER}, @@ -238,7 +237,6 @@ async fn wrapped_main() -> Result<()> { scan_manager::initialize(handles.clone()); } - handles.output.sync().await?; if CONFIGURATION.resumed { let scanned_urls = handles.ferox_scans()?; let from_here = CONFIGURATION.resume_from.clone(); @@ -280,7 +278,7 @@ async fn wrapped_main() -> Result<()> { // The TermOutHandler spawns a FileOutHandler, so errors in the FileOutHandler never bubble // up due to the TermOutHandler never awaiting the result of FileOutHandler::start (that's // done later here in main). Ping checks that the tx/rx connection to the file handler works - if !CONFIGURATION.output.is_empty() && handles.output.tx_file.send(Command::Ping).is_err() { + if !CONFIGURATION.output.is_empty() && handles.output.sync().await.is_err() { // output file specified and file handler could not initialize clean_up(handles, tasks).await?; let msg = format!("Couldn't start {} file handler", CONFIGURATION.output);