MCPcopy
hub / github.com/claude-code-best/claude-code / background

Method background

src/utils/ShellCommand.ts:349–366  ·  view source on GitHub ↗
(taskId: string)

Source from the content-addressed store, hash-verified

347 }
348
349 background(taskId: string): boolean {
350 if (this.#status === 'running') {
351 this.#backgroundTaskId = taskId
352 this.#status = 'backgrounded'
353 this.#cleanupListeners()
354 if (this.taskOutput.stdoutToFile) {
355 // File mode: child writes directly to the fd with no JS involvement.
356 // The foreground timeout is gone, so watch file size to prevent
357 // a stuck append loop from filling the disk (768GB incident).
358 this.#startSizeWatchdog()
359 } else {
360 // Pipe mode: spill the in-memory buffer so readers can find it on disk.
361 this.taskOutput.spillToDisk()
362 }
363 return true
364 }
365 return false
366 }
367
368 cleanup(): void {
369 this.#stdoutWrapper?.cleanup()

Callers 4

executeInBackgroundFunction · 0.45
spawnShellTaskFunction · 0.45
backgroundTaskFunction · 0.45

Calls 3

#cleanupListenersMethod · 0.95
#startSizeWatchdogMethod · 0.95
spillToDiskMethod · 0.80

Tested by

no test coverage detected