summaryrefslogtreecommitdiff
path: root/cli/util
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-23 19:00:48 -0400
committerGitHub <noreply@github.com>2024-07-23 19:00:48 -0400
commit9114a2df69da9318c4e10887553b7daf77b0fa16 (patch)
tree2309817e74485f9fe8f7b79238afa026070b79df /cli/util
parent6055629ee7f48a4e887392ccac13788aa4008249 (diff)
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
Diffstat (limited to 'cli/util')
-rw-r--r--cli/util/file_watcher.rs15
1 files changed, 10 insertions, 5 deletions
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<O, F>(
- flags: Flags,
+ flags: Arc<Flags>,
print_config: PrintConfig,
operation: O,
) -> Result<(), AnyError>
where
O: FnMut(
- Flags,
+ Arc<Flags>,
Arc<WatcherCommunicator>,
Option<Vec<PathBuf>>,
) -> Result<F, AnyError>,
@@ -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<O, F>(
- mut flags: Flags,
+ mut flags: Arc<Flags>,
print_config: PrintConfig,
restart_mode: WatcherRestartMode,
mut operation: O,
) -> Result<(), AnyError>
where
O: FnMut(
- Flags,
+ Arc<Flags>,
Arc<WatcherCommunicator>,
Option<Vec<PathBuf>>,
) -> Result<F, AnyError>,
@@ -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 => {},