Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/sync/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,14 @@ export class FileWatcher {
*/
private handleChange(rel: string): void {
if (!rel || rel === '.' || rel.startsWith('..')) return;
// Windows fs.watch recursive can deliver events from outside the project
// root via ReadDirectoryChangesW (e.g., %ProgramData% paths from system
// services). After normalizePath these arrive as absolute-looking paths
// like "/ProgramData/Autodesk/CER", which would crash the ignore matcher
// with "path should be a `path.relative()`d string" RangeError.
// Reject any absolute path here — a legitimate project-relative change
// is never absolute.
if (path.isAbsolute(rel)) return;
if (this.isAlwaysIgnored(rel)) return;
if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel)) return;
if (!isSourceFile(rel, loadExtensionOverrides(this.projectRoot))) return;
Expand Down