From ea2c7ac5566e6973cdd68aaa8aa3dcb8c51a5865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 31 May 2021 16:53:49 +0200 Subject: [PATCH] fix: running subcommand with coverage collection (#10802) --- cli/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/main.rs b/cli/main.rs index 47bc52981e..db99d4e4e4 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -896,8 +896,9 @@ async fn run_command(flags: Flags, script: String) -> Result<(), AnyError> { let coverage_dir = PathBuf::from(coverage_dir); let mut coverage_collector = tools::coverage::CoverageCollector::new(coverage_dir, session); - coverage_collector.start_collecting().await?; - + worker + .with_event_loop(coverage_collector.start_collecting().boxed_local()) + .await?; Some(coverage_collector) } else { None @@ -912,9 +913,10 @@ async fn run_command(flags: Flags, script: String) -> Result<(), AnyError> { worker.execute("window.dispatchEvent(new Event('unload'))")?; if let Some(coverage_collector) = maybe_coverage_collector.as_mut() { - coverage_collector.stop_collecting().await?; + worker + .with_event_loop(coverage_collector.stop_collecting().boxed_local()) + .await?; } - Ok(()) }