( recoveryPreamble: string, diff: Diff, name: string, )
| 291 | } |
| 292 | |
| 293 | async function runAltScreenRecoveryCapture( |
| 294 | recoveryPreamble: string, |
| 295 | diff: Diff, |
| 296 | name: string, |
| 297 | ): Promise<{ mid: string; final: string }> { |
| 298 | const tmpDir = mkdtempSync(join(tmpdir(), 'code-tmux-alt-screen-recovery-')) |
| 299 | try { |
| 300 | const preamblePath = join(tmpDir, `${name}.preamble.seq`) |
| 301 | const diffPath = join(tmpDir, `${name}.diff.seq`) |
| 302 | const midReadyPath = join(tmpDir, `${name}.mid.ready`) |
| 303 | const donePath = join(tmpDir, `${name}.done.ready`) |
| 304 | writeFileSync(preamblePath, recoveryPreamble) |
| 305 | writeFileSync(diffPath, serializeDiff(diff)) |
| 306 | |
| 307 | const session = createIsolatedTmuxSession({ |
| 308 | command: |
| 309 | `bash -lc '` + |
| 310 | `printf "\\033[?1049h"; ` + |
| 311 | `printf "OLD1\\nOLD2\\nOLD3"; ` + |
| 312 | `cat ${shellQuote(preamblePath)}; ` + |
| 313 | `touch ${shellQuote(midReadyPath)}; ` + |
| 314 | `sleep 1; ` + |
| 315 | `cat ${shellQuote(diffPath)}; ` + |
| 316 | `touch ${shellQuote(donePath)}; ` + |
| 317 | `sleep 5` + |
| 318 | `'`, |
| 319 | width: 80, |
| 320 | height: 10, |
| 321 | }) |
| 322 | liveSessions.push(session) |
| 323 | |
| 324 | await waitForFile(midReadyPath) |
| 325 | const mid = capturePane(session, { startLine: -40 }) |
| 326 | await waitForFile(donePath) |
| 327 | const final = capturePane(session, { startLine: -40 }) |
| 328 | return { mid, final } |
| 329 | } finally { |
| 330 | rmSync(tmpDir, { recursive: true, force: true }) |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | async function runNormalScreenRepaintBelowPromptCapture( |
| 335 | initialDiff: Diff, |
no test coverage detected