1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00

fix: running subcommand with coverage collection (#10802)

This commit is contained in:
Bartek Iwańczuk 2021-05-31 16:53:49 +02:00 committed by GitHub
parent 76d343002e
commit ea2c7ac556
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(())
}