Cleanup a PTY session: SIGINT, then SIGKILL after 3s.
(session: PtySession)
| 354 | |
| 355 | /** Cleanup a PTY session: SIGINT, then SIGKILL after 3s. */ |
| 356 | function disposeSession(session: PtySession): void { |
| 357 | try { session.proc?.terminal?.close?.(); } catch {} |
| 358 | if (session.proc?.pid) { |
| 359 | try { session.proc.kill?.('SIGINT'); } catch {} |
| 360 | setTimeout(() => { |
| 361 | try { |
| 362 | if (session.proc && !session.proc.killed) session.proc.kill?.('SIGKILL'); |
| 363 | } catch {} |
| 364 | }, 3000); |
| 365 | } |
| 366 | session.proc = null; |
| 367 | session.spawned = false; |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Build the HTTP server. Two routes: |