MCPcopy Index your code
hub / github.com/codeaashu/claude-code / #startSizeWatchdog

Method #startSizeWatchdog

src/utils/ShellCommand.ts:239–261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

237 }
238
239 #startSizeWatchdog(): void {
240 this.#sizeWatchdog = setInterval(() => {
241 void stat(this.taskOutput.path).then(
242 s => {
243 // Bail if the watchdog was cleared while this stat was in flight
244 // (process exited on its own) — otherwise we'd mislabel stderr.
245 if (
246 s.size > this.#maxOutputBytes &&
247 this.#status === 'backgrounded' &&
248 this.#sizeWatchdog !== null
249 ) {
250 this.#killedForSize = true
251 this.#clearSizeWatchdog()
252 this.#doKill(SIGKILL)
253 }
254 },
255 () => {
256 // ENOENT before first write, or unlinked mid-run — skip this tick
257 },
258 )
259 }, SIZE_WATCHDOG_INTERVAL_MS)
260 this.#sizeWatchdog.unref()
261 }
262
263 #createResultPromise(): Promise<ExecResult> {
264 this.#boundAbortHandler = this.#abortHandler.bind(this)

Callers 1

backgroundMethod · 0.95

Calls 3

#clearSizeWatchdogMethod · 0.95
#doKillMethod · 0.95
statFunction · 0.85

Tested by

no test coverage detected