()
| 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) |
no test coverage detected