diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-10-19 07:05:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 07:05:00 +0200 |
commit | 8d9fef3b8955eadfd4820455b422b5bec1cdad0a (patch) | |
tree | 7114c3e3c329c83ce1d9c90e8fab5c7104bd1579 /cli/tools/bench/mod.rs | |
parent | 5095af78018f1d77374bc06cbb58231e631056b9 (diff) |
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
Diffstat (limited to 'cli/tools/bench/mod.rs')
-rw-r--r-- | cli/tools/bench/mod.rs | 9 |
1 files changed, 4 insertions, 5 deletions
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(); |