From 8d9fef3b8955eadfd4820455b422b5bec1cdad0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 19 Oct 2023 07:05:00 +0200 Subject: refactor: add WatcherCommunicator helper struct (#20927) This commit introduces "WatcherCommunicator" struct that is used facilitate bi-directional communication between CLI file watcher and the watched function. Prerequisite for https://github.com/denoland/deno/pull/20876 --- cli/tools/bench/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cli/tools/bench/mod.rs') diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs index 454a97126..eb400442e 100644 --- a/cli/tools/bench/mod.rs +++ b/cli/tools/bench/mod.rs @@ -417,19 +417,18 @@ pub async fn run_benchmarks_with_watch( .map(|w| !w.no_clear_screen) .unwrap_or(true), }, - move |flags, sender, changed_paths| { + move |flags, watcher_communicator, changed_paths| { let bench_flags = bench_flags.clone(); Ok(async move { let factory = CliFactoryBuilder::new() - .with_watcher(sender.clone()) - .build_from_flags(flags) + .build_from_flags_for_watcher(flags, watcher_communicator.clone()) .await?; let cli_options = factory.cli_options(); let bench_options = cli_options.resolve_bench_options(bench_flags)?; - let _ = sender.send(cli_options.watch_paths()); + let _ = watcher_communicator.watch_paths(cli_options.watch_paths()); if let Some(include) = &bench_options.files.include { - let _ = sender.send(include.clone()); + let _ = watcher_communicator.watch_paths(include.clone()); } let graph_kind = cli_options.type_check_mode().as_graph_kind(); -- cgit v1.2.3