()
| 366 | } |
| 367 | |
| 368 | cleanup(): void { |
| 369 | this.#stdoutWrapper?.cleanup() |
| 370 | this.#stderrWrapper?.cleanup() |
| 371 | this.taskOutput.clear() |
| 372 | // Must run before nulling #abortSignal — #cleanupListeners() calls |
| 373 | // removeEventListener on it. Without this, a kill()+cleanup() sequence |
| 374 | // crashes: kill() queues #handleExit as a microtask, cleanup() nulls |
| 375 | // #abortSignal, then #handleExit runs #cleanupListeners() on the null ref. |
| 376 | this.#cleanupListeners() |
| 377 | // Release references to allow GC of ChildProcess internals and AbortController chain |
| 378 | this.#childProcess = null! |
| 379 | this.#abortSignal = null! |
| 380 | this.#onTimeoutCallback = undefined |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | /** |
nothing calls this directly
no test coverage detected