diff options
| author | Dax Raad <[email protected]> | 2025-10-09 18:29:18 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-10-09 18:29:18 -0400 |
| commit | d91781c6393115c958cf741d6e7c3a2d8daf6b4d (patch) | |
| tree | 6e9329a76b95e4c12107df5c8ea23fb88d5fe777 | |
| parent | f3b71007d2d05529a755dddf5e73a69507f8ada7 (diff) | |
| download | opencode-d91781c6393115c958cf741d6e7c3a2d8daf6b4d.tar.gz opencode-d91781c6393115c958cf741d6e7c3a2d8daf6b4d.zip | |
core: use platform-specific watcher backends for better file system monitoring
| -rw-r--r-- | packages/opencode/src/file/watcher.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/opencode/src/file/watcher.ts b/packages/opencode/src/file/watcher.ts index f7827c677..1bae71cfb 100644 --- a/packages/opencode/src/file/watcher.ts +++ b/packages/opencode/src/file/watcher.ts @@ -34,6 +34,16 @@ export namespace FileWatcher { if (Instance.project.vcs !== "git") return {} log.info("init") const cfg = await Config.get() + const backend = (() => { + if (process.platform === "win32") return "windows" + if (process.platform === "darwin") return "fs-events" + if (process.platform === "linux") return "inotify" + })() + if (!backend) { + log.error("watcher backend not supported", { platform: process.platform }) + return {} + } + log.info("watcher backend", { platform: process.platform, backend }) const sub = await watcher().subscribe( Instance.directory, (err, evts) => { @@ -47,7 +57,7 @@ export namespace FileWatcher { }, { ignore: [...FileIgnore.PATTERNS, ...(cfg.watcher?.ignore ?? [])], - backend: "inotify", + backend, }, ) return { sub } |
