()
| 351 | } |
| 352 | |
| 353 | export const cleanup = () => { |
| 354 | logger.info("[Pty] Cleanup called, killing all active PTYs") |
| 355 | |
| 356 | for (const [ptyId, p] of activePtys) { |
| 357 | if (p.cleanupTimeoutId) { |
| 358 | clearTimeout(p.cleanupTimeoutId) |
| 359 | } |
| 360 | |
| 361 | if (!p.exited) { |
| 362 | try { |
| 363 | p.pty.kill() |
| 364 | } catch { |
| 365 | // Ignore errors during cleanup |
| 366 | } |
| 367 | emitLifecycle({ type: "killed", ptyId }) |
| 368 | } |
| 369 | |
| 370 | activePtys.delete(ptyId) |
| 371 | } |
| 372 | |
| 373 | logger.info("[Pty] Cleanup complete") |
| 374 | } |
no test coverage detected