aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/feature_flags.zig2
-rw-r--r--src/watcher.zig10
2 files changed, 8 insertions, 4 deletions
diff --git a/src/feature_flags.zig b/src/feature_flags.zig
index b9bcf3bab..42c1d1782 100644
--- a/src/feature_flags.zig
+++ b/src/feature_flags.zig
@@ -84,3 +84,5 @@ pub const disable_compression_in_http_client = false;
// Time (mean ± σ): 306.7 ms ± 6.1 ms [User: 31.7 ms, System: 269.8 ms]
// Range (min … max): 299.5 ms … 318.8 ms 10 runs
pub const use_libgit2 = true;
+
+pub const atomic_file_watcher = env.isLinux;
diff --git a/src/watcher.zig b/src/watcher.zig
index 33d5aa9a3..35606f697 100644
--- a/src/watcher.zig
+++ b/src/watcher.zig
@@ -532,10 +532,12 @@ pub fn NewWatcher(comptime ContextType: type) type {
comptime copy_file_path: bool,
) !void {
if (this.indexOf(hash)) |index| {
- // On Linux, the file descriptor might be out of date.
- if (fd > 0) {
- var fds = this.watchlist.items(.fd);
- fds[index] = fd;
+ if (comptime FeatureFlags.atomic_file_watcher) {
+ // On Linux, the file descriptor might be out of date.
+ if (fd > 0) {
+ var fds = this.watchlist.items(.fd);
+ fds[index] = fd;
+ }
}
return;
}