Skip to content

Commit 5cf5463

Browse files
committed
Stop following symlinks.
1 parent edf4111 commit 5cf5463

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

pkgs/watcher/lib/src/directory_watcher/linux.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ class _LinuxDirectoryWatcher
239239

240240
/// Emits [ChangeType.ADD] events for the recursive contents of [path].
241241
void _addSubdir(String path) {
242-
_listen(Directory(path).list(recursive: true), (FileSystemEntity entity) {
242+
_listen(Directory(path).list(recursive: true, followLinks: false),
243+
(FileSystemEntity entity) {
243244
if (entity is Directory) {
244245
_watchSubdir(entity.path);
245246
} else {

pkgs/watcher/lib/src/directory_watcher/mac_os.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class _MacOSDirectoryWatcher
149149
if (_files.containsDir(path)) continue;
150150

151151
var stream = Directory(path)
152-
.list(recursive: true)
152+
.list(recursive: true, followLinks: false)
153153
.ignoring<PathNotFoundException>();
154154
var subscription = stream.listen((entity) {
155155
if (entity is Directory) return;

pkgs/watcher/lib/src/directory_watcher/windows.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class _WindowsDirectoryWatcher
217217
// itself, so there are no other types of "path not found" that
218218
// might need different handling here.
219219
var stream = Directory(path)
220-
.list(recursive: true)
220+
.list(recursive: true, followLinks: false)
221221
.ignoring<PathNotFoundException>();
222222
var subscription = stream.listen((entity) {
223223
if (entity is Directory) return;

pkgs/watcher/lib/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ extension DirectoryRobustRecursiveListing on Directory {
7979
///
8080
/// Theses can arise from concurrent file-system modification.
8181
Stream<FileSystemEntity> listRecursivelyIgnoringErrors() {
82-
return list(recursive: true)
82+
return list(recursive: true, followLinks: false)
8383
.ignoring<PathNotFoundException>()
8484
.ignoring<PathAccessException>();
8585
}

0 commit comments

Comments
 (0)