don't remove watcher on linux

Cole Miller and Kate created

Co-authored-by: Kate <kate@zed.dev> Co-authored-by: John <jtur@zed.dev>

Change summary

crates/fs/src/fs_watcher.rs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

Detailed changes

crates/fs/src/fs_watcher.rs 🔗

@@ -203,10 +203,13 @@ impl GlobalWatcher {
             state.path_registrations.remove(&registration_state.path);
 
             drop(state);
-            self.watcher
-                .lock()
-                .unwatch(&registration_state.path)
-                .log_err();
+
+            if !cfg!(target_os = "linux") {
+                self.watcher
+                    .lock()
+                    .unwatch(&registration_state.path)
+                    .log_err();
+            }
         }
     }
 }