mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
Some checks are pending
check / typecheck (push) Waiting to run
containers / build (push) Waiting to run
deploy-files / deploy (push) Waiting to run
deploy-www / deploy (push) Waiting to run
deploy / deploy (push) Waiting to run
nix-eval / nix-eval (push) Waiting to run
nix-hashes / compute-hash (blacksmith-4vcpu-ubuntu-2404, x86_64-linux) (push) Waiting to run
nix-hashes / compute-hash (blacksmith-4vcpu-ubuntu-2404-arm, aarch64-linux) (push) Waiting to run
nix-hashes / compute-hash (macos-latest, aarch64-darwin) (push) Waiting to run
nix-hashes / update-hashes (push) Blocked by required conditions
publish / version (push) Waiting to run
publish / build-cli (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--os=darwin --cpu=x64 host:macos-26-intel platform_flag:--mac --x64 target:x86_64-apple-darwin]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404 platform_flag:--linux target:x86_64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-ubuntu-2404-arm platform_flag:--linux --arm64 target:aarch64-unknown-linux-gnu]) (push) Blocked by required conditions
publish / build-electron (map[host:blacksmith-4vcpu-windows-2025 platform_flag:--win target:x86_64-pc-windows-msvc]) (push) Blocked by required conditions
publish / publish (push) Blocked by required conditions
publish / sign-cli-macos (push) Blocked by required conditions
publish / build-node-app-archive (push) Blocked by required conditions
publish / build-node-cli (map[bun_install_flags:--cpu=* host:blacksmith-4vcpu-windows-2025 target:windows-arm64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:blacksmith-4vcpu-ubuntu-2404 target:linux-x64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:blacksmith-4vcpu-ubuntu-2404-arm target:linux-arm64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:blacksmith-4vcpu-windows-2025 target:windows-x64]) (push) Blocked by required conditions
publish / build-node-cli (map[host:macos-26 target:darwin-arm64]) (push) Blocked by required conditions
publish / sign-cli-windows (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--cpu=* host:windows-2025 platform_flag:--win --arm64 target:aarch64-pc-windows-msvc]) (push) Blocked by required conditions
publish / build-electron (map[bun_install_flags:--os=darwin --cpu=arm64 host:macos-26 platform_flag:--mac --arm64 target:aarch64-apple-darwin]) (push) Blocked by required conditions
publish / notify-discord-v2 (push) Blocked by required conditions
storybook / storybook build (push) Waiting to run
test / unit (windows) (push) Waiting to run
test / build (linux) (push) Waiting to run
test / build (windows) (push) Waiting to run
test / e2e (linux) (push) Blocked by required conditions
test / e2e (windows) (push) Blocked by required conditions
test / affected packages (push) Waiting to run
test / unit (linux) (push) Waiting to run
test / e2e (linux, app-1) (push) Blocked by required conditions
test / e2e (linux, app-2) (push) Blocked by required conditions
test / e2e (linux, app-components) (push) Blocked by required conditions
test / e2e (linux, session-ui-components) (push) Blocked by required conditions
test / e2e (windows, app-1) (push) Blocked by required conditions
test / e2e (windows, app-2) (push) Blocked by required conditions
test / e2e (windows, app-components) (push) Blocked by required conditions
test / e2e (windows, session-ui-components) (push) Blocked by required conditions
24 lines
1 KiB
TypeScript
24 lines
1 KiB
TypeScript
import { watch, type WatchListener } from "node:fs"
|
|
|
|
/**
|
|
* Watch a path without letting a failed watch take down the TUI. fs.watch throws
|
|
* synchronously when the host cannot allocate one (e.g. ENOSPC/EMFILE when the
|
|
* inotify budget is exhausted) and emits "error" later if the watch breaks; an
|
|
* unhandled "error" event crashes the process. Losing live-reload is recoverable,
|
|
* so both paths close the watch and log. Honors the server's disable switch.
|
|
*/
|
|
export function safeWatch(target: string, listener: WatchListener<string>) {
|
|
const disabled = process.env.OPENCODE_FILEWATCHER_DISABLE ?? process.env.OPENCODE_DISABLE_FILEWATCHER
|
|
if (disabled === "1" || disabled?.toLowerCase() === "true") return
|
|
try {
|
|
const watcher = watch(target, listener)
|
|
watcher.on("error", (error) => {
|
|
watcher.close()
|
|
console.error("Watch failed, live-reload disabled", { target, error })
|
|
})
|
|
return watcher
|
|
} catch (error) {
|
|
console.error("Failed to watch path, live-reload disabled", { target, error })
|
|
return
|
|
}
|
|
}
|