diff options
Diffstat (limited to 'cli/util/file_watcher.rs')
-rw-r--r-- | cli/util/file_watcher.rs | 15 |
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 => {}, |