From 9114a2df69da9318c4e10887553b7daf77b0fa16 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Tue, 23 Jul 2024 19:00:48 -0400 Subject: fix(upgrade): do not error if config in cwd invalid (#24689) ``` > deno upgrade error: Unsupported lockfile version 'invalid'. Try upgrading Deno or recreating the lockfile. V:\scratch > V:\deno\target\debug\deno upgrade Looking up latest version Local deno version 1.45.3 is the most recent release ``` Closes #24517 Closes #20729 --- cli/util/file_watcher.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'cli/util') diff --git a/cli/util/file_watcher.rs b/cli/util/file_watcher.rs index 176ca43f0..51dde8404 100644 --- a/cli/util/file_watcher.rs +++ b/cli/util/file_watcher.rs @@ -198,13 +198,13 @@ impl WatcherCommunicator { /// changes. For example, in the case where we would like to bundle, then `operation` would /// have the logic for it like bundling the code. pub async fn watch_func( - flags: Flags, + flags: Arc, print_config: PrintConfig, operation: O, ) -> Result<(), AnyError> where O: FnMut( - Flags, + Arc, Arc, Option>, ) -> Result, @@ -237,14 +237,14 @@ pub enum WatcherRestartMode { /// changes. For example, in the case where we would like to bundle, then `operation` would /// have the logic for it like bundling the code. pub async fn watch_recv( - mut flags: Flags, + mut flags: Arc, print_config: PrintConfig, restart_mode: WatcherRestartMode, mut operation: O, ) -> Result<(), AnyError> where O: FnMut( - Flags, + Arc, Arc, Option>, ) -> Result, @@ -321,7 +321,12 @@ where )?); // don't reload dependencies after the first run - flags.reload = false; + if flags.reload { + flags = Arc::new(Flags { + reload: false, + ..Arc::unwrap_or_clone(flags) + }); + } select! { _ = receiver_future => {}, -- cgit v1.2.3