From 4b6bfc892c53e891fa366c3c963d232eadbdb710 Mon Sep 17 00:00:00 2001 From: eternal-flame-AD Date: Sun, 18 Jun 2023 21:25:55 -0500 Subject: [PATCH] properly quit and wait webdriver --- src/apps/webcheck/driver/chrome.rs | 3 +++ src/apps/webcheck/mod.rs | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/apps/webcheck/driver/chrome.rs b/src/apps/webcheck/driver/chrome.rs index 98cb916..e6e40bf 100644 --- a/src/apps/webcheck/driver/chrome.rs +++ b/src/apps/webcheck/driver/chrome.rs @@ -62,6 +62,9 @@ impl Drop for ChromeDriver { if let Err(e) = child.kill() { log::error!("Error killing chrome driver: {}", e); } + if let Err(e) = child.wait() { + log::error!("Error waiting for chrome driver to exit: {}", e); + } } } } diff --git a/src/apps/webcheck/mod.rs b/src/apps/webcheck/mod.rs index 64a0065..ae4a9d5 100644 --- a/src/apps/webcheck/mod.rs +++ b/src/apps/webcheck/mod.rs @@ -92,7 +92,14 @@ impl WebcheckApp { caps.set_disable_gpu().unwrap(); let driver = driver.connect(caps).await?; - let response = checker.check(&driver).await?; + let response = match checker.check(&driver).await { + Ok(response) => response, + Err(e) => { + driver.quit().await?; + return Err(e); + } + }; + driver.quit().await?; let new_response = LastResponse { response: response.clone(),