MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / dispose

Method dispose

src/workspaces/persistent-session.ts:416–445  ·  view source on GitHub ↗
(reason: string)

Source from the content-addressed store, hash-verified

414 }
415
416 dispose(reason: string): void {
417 if (this.disposed) return;
418 this.disposed = true;
419 if (this.cursorTimer) {
420 clearInterval(this.cursorTimer);
421 this.cursorTimer = null;
422 }
423 if (this.respawnTimer) {
424 clearTimeout(this.respawnTimer);
425 this.respawnTimer = null;
426 }
427 try {
428 this.term.kill();
429 } catch {
430 // already dead
431 }
432 const ws = this.ws;
433 if (ws !== null) {
434 this.unwireWs(ws);
435 this.ws = null;
436 this.controller = null;
437 try {
438 ws.close(1000, `disposed: ${reason}`);
439 } catch {
440 // ignore
441 }
442 }
443 this.log.info('session.disposed', { reason });
444 this.opts.onDisposed();
445 }
446
447 private onPtyData(data: Buffer | string): void {
448 if (this.disposed) return;

Callers 2

onChildExitMethod · 0.95
respawnNowMethod · 0.95

Calls 3

unwireWsMethod · 0.95
infoMethod · 0.80
closeMethod · 0.65

Tested by

no test coverage detected