diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-01-30 16:22:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-30 16:22:17 +0100 |
commit | d318e38b76c8174d48fddfb99064401050cd8333 (patch) | |
tree | bd49caad1dcc6507280b8ebf4b7f68e2ff9c5c78 /cli/tools/run.rs | |
parent | 3035dee9f14402f57d42ff0b362152140b4dca13 (diff) |
Revert "fix(watch): preserve `ProcState::file_fetcher` between restarts (#15466) (#17591)
This reverts commit 3545bff678f20c3fdf17fe6b26f96cf1b74f917c.
Diffstat (limited to 'cli/tools/run.rs')
-rw-r--r-- | cli/tools/run.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cli/tools/run.rs b/cli/tools/run.rs index 2d001c42b..d5b5eb981 100644 --- a/cli/tools/run.rs +++ b/cli/tools/run.rs @@ -1,6 +1,7 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. use std::io::Read; +use std::path::PathBuf; use std::sync::Arc; use deno_ast::MediaType; @@ -102,13 +103,16 @@ async fn run_with_watch(flags: Flags, script: String) -> Result<i32, AnyError> { let flags = Arc::new(flags); let main_module = resolve_url_or_path(&script)?; let (sender, receiver) = tokio::sync::mpsc::unbounded_channel(); - let mut ps = - ProcState::build_for_file_watcher((*flags).clone(), sender.clone()).await?; - let operation = |main_module: ModuleSpecifier| { - ps.reset_for_file_watcher(); - let ps = ps.clone(); + let operation = |(sender, main_module): ( + tokio::sync::mpsc::UnboundedSender<Vec<PathBuf>>, + ModuleSpecifier, + )| { + let flags = flags.clone(); Ok(async move { + let ps = + ProcState::build_for_file_watcher((*flags).clone(), sender.clone()) + .await?; let permissions = PermissionsContainer::new(Permissions::from_options( &ps.options.permissions_options(), )?); @@ -122,7 +126,7 @@ async fn run_with_watch(flags: Flags, script: String) -> Result<i32, AnyError> { util::file_watcher::watch_func2( receiver, operation, - main_module, + (sender, main_module), util::file_watcher::PrintConfig { job_name: "Process".to_string(), clear_screen: !flags.no_clear_screen, |