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