MCPcopy
hub / github.com/garrytan/gstack / disposeSession

Function disposeSession

browse/src/terminal-agent.ts:356–368  ·  view source on GitHub ↗

Cleanup a PTY session: SIGINT, then SIGKILL after 3s.

(session: PtySession)

Source from the content-addressed store, hash-verified

354
355/** Cleanup a PTY session: SIGINT, then SIGKILL after 3s. */
356function 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:

Callers 2

fetchFunction · 0.85
closeFunction · 0.85

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected