( diff: Diff, name: string, )
| 207 | } |
| 208 | |
| 209 | async function runSplitRenderedDiffCapture( |
| 210 | diff: Diff, |
| 211 | name: string, |
| 212 | ): Promise<{ mid: string; final: string }> { |
| 213 | const tmpDir = mkdtempSync(join(tmpdir(), 'code-tmux-split-rendered-reset-')) |
| 214 | try { |
| 215 | const serializedDiff = serializeDiff(diff) |
| 216 | const [firstChunk, secondChunk] = splitAfterFirstRenderedRow(serializedDiff) |
| 217 | const firstChunkPath = join(tmpDir, `${name}.part1.seq`) |
| 218 | const secondChunkPath = join(tmpDir, `${name}.part2.seq`) |
| 219 | const midReadyPath = join(tmpDir, `${name}.mid.ready`) |
| 220 | const donePath = join(tmpDir, `${name}.done.ready`) |
| 221 | writeFileSync(firstChunkPath, firstChunk) |
| 222 | writeFileSync(secondChunkPath, secondChunk) |
| 223 | |
| 224 | const session = createIsolatedTmuxSession({ |
| 225 | command: |
| 226 | `bash -lc '` + |
| 227 | `i=1; ` + |
| 228 | `while [ "$i" -le 40 ]; do printf "L%02d\\n" "$i"; i=$((i+1)); done; ` + |
| 229 | `cat ${shellQuote(firstChunkPath)}; ` + |
| 230 | `touch ${shellQuote(midReadyPath)}; ` + |
| 231 | `sleep 1; ` + |
| 232 | `cat ${shellQuote(secondChunkPath)}; ` + |
| 233 | `touch ${shellQuote(donePath)}; ` + |
| 234 | `sleep 5` + |
| 235 | `'`, |
| 236 | width: 80, |
| 237 | height: 10, |
| 238 | }) |
| 239 | liveSessions.push(session) |
| 240 | |
| 241 | await waitForFile(midReadyPath) |
| 242 | const mid = capturePane(session, { startLine: -80 }) |
| 243 | await waitForFile(donePath) |
| 244 | const final = capturePane(session, { startLine: -80 }) |
| 245 | return { mid, final } |
| 246 | } finally { |
| 247 | rmSync(tmpDir, { recursive: true, force: true }) |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | async function runAltScreenPreambleCapture( |
| 252 | diff: Diff, |
no test coverage detected