(reason: string)
| 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; |
no test coverage detected