properly quit and wait webdriver

This commit is contained in:
ゆめ 2023-06-18 21:25:55 -05:00
parent 70a93aeb0b
commit 4b6bfc892c
2 changed files with 11 additions and 1 deletions

View file

@ -62,6 +62,9 @@ impl Drop for ChromeDriver {
if let Err(e) = child.kill() { if let Err(e) = child.kill() {
log::error!("Error killing chrome driver: {}", e); log::error!("Error killing chrome driver: {}", e);
} }
if let Err(e) = child.wait() {
log::error!("Error waiting for chrome driver to exit: {}", e);
}
} }
} }
} }

View file

@ -92,7 +92,14 @@ impl WebcheckApp {
caps.set_disable_gpu().unwrap(); caps.set_disable_gpu().unwrap();
let driver = driver.connect(caps).await?; 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 { let new_response = LastResponse {
response: response.clone(), response: response.clone(),