(opts: PersistentSessionOptions)
| 110 | private exitWaiters: Set<(info: { code: number; signal: number | null }) => void> = new Set(); |
| 111 | |
| 112 | constructor(opts: PersistentSessionOptions) { |
| 113 | this.opts = opts; |
| 114 | this.log = opts.logger.child({ |
| 115 | wsId: opts.wsId, |
| 116 | recordId: opts.recordId, |
| 117 | name: opts.name, |
| 118 | }); |
| 119 | this.buffer = new ReplayBuffer(opts.replayBufferBytes); |
| 120 | if (opts.initialReplayBytes && opts.initialReplayBytes.length > 0) { |
| 121 | // Seed the buffer so the very first WebSocket attach replays this as |
| 122 | // scrollback. Subsequent PTY output appends below. |
| 123 | this.buffer.append(opts.initialReplayBytes); |
| 124 | } |
| 125 | this.currentCols = clamp(opts.initialCols, 1, MAX_DIM); |
| 126 | this.currentRows = clamp(opts.initialRows, 1, MAX_DIM); |
| 127 | |
| 128 | this.term = this.spawnChild(); |
| 129 | this.log.info('session.spawned', { |
| 130 | pid: this.term.pid, |
| 131 | command: opts.command, |
| 132 | cwd: opts.cwd, |
| 133 | }); |
| 134 | } |
| 135 | |
| 136 | private spawnChild(): pty.IPty { |
| 137 | if (this.opts.command.length === 0) { |
nothing calls this directly
no test coverage detected