(live: LivePtyShellRun, data: string)
| 987 | } |
| 988 | |
| 989 | private onPtyData(live: LivePtyShellRun, data: string): void { |
| 990 | if (live.driverExit || live.finalizeOnce) return; |
| 991 | live.rawBuffer = `${live.rawBuffer}${data}`.slice(-PTY_RAW_REPLAY_CHARS); |
| 992 | live.collector.accept(data); |
| 993 | for (const chunk of splitPtyData(data)) { |
| 994 | const combined = `${live.pendingRawData}${chunk}`; |
| 995 | if (live.pendingRawData && encodedPtyDataBytes(combined) > PTY_RAW_PUBLISH_MAX_BYTES) { |
| 996 | this.publishPtyData(live); |
| 997 | } |
| 998 | live.rawSequence += 1; |
| 999 | live.pendingRawData += chunk; |
| 1000 | if (encodedPtyDataBytes(live.pendingRawData) >= PTY_RAW_PUBLISH_TARGET_BYTES) { |
| 1001 | this.publishPtyData(live); |
| 1002 | } |
| 1003 | } |
| 1004 | if (!live.pendingRawData) return; |
| 1005 | live.rawPublishTimer ??= setTimeout(() => { |
| 1006 | live.rawPublishTimer = undefined; |
| 1007 | this.publishPtyData(live); |
| 1008 | }, PTY_RAW_PUBLISH_INTERVAL_MS); |
| 1009 | } |
| 1010 | |
| 1011 | private publishPtyData(live: LivePtyShellRun): void { |
| 1012 | if (live.rawPublishTimer) { |
no test coverage detected