* macOS/Windows: one recursive watcher for the whole tree. O(1) descriptors. * `filename` arrives relative to the project root (with subdirectories), so * it maps straight to a project-relative path.
()
| 396 | * it maps straight to a project-relative path. |
| 397 | */ |
| 398 | private startRecursive(): void { |
| 399 | this.recursiveWatcher = watchImpl( |
| 400 | this.projectRoot, |
| 401 | { recursive: true, persistent: true }, |
| 402 | (_event, filename) => { |
| 403 | if (this.stopped || filename == null) return; |
| 404 | this.handleChange(normalizePath(String(filename))); |
| 405 | } |
| 406 | ); |
| 407 | this.recursiveWatcher.on('error', (err: unknown) => { |
| 408 | if (isWatchResourceExhaustion(err)) { |
| 409 | this.degrade(EXHAUSTION_REASON, { error: String(err) }); |
| 410 | return; |
| 411 | } |
| 412 | logWarn('File watcher error', { error: String(err) }); |
| 413 | }); |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Linux: walk the (non-ignored) tree and watch each directory. One inotify |
no test coverage detected