spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

fix: disable Rich Live transient mode on Windows to prevent PS 5.1 hang

Open mnriem opened this issue 5 months ago • 0 comments

Summary

Fixes #2927 — specify init hangs indefinitely on Windows PowerShell 5.1 after writing files.

Root Cause

Rich's Live(transient=True) attempts cursor restoration via VT escape sequences when the context manager exits. PowerShell 5.1's legacy console host (conhost.exe) does not reliably support these sequences, causing the cleanup to deadlock.

The hang occurs at line 297 of init.py when the Live block exits — after all files have been written successfully but before "Project ready" prints.

Fix

Set transient=False when sys.platform == "win32" in both locations that use Live(transient=True):

  • src/specify_cli/commands/init.py — progress tracker during scaffolding
  • src/specify_cli/_console.py — select_with_arrows() interactive menu

The only cosmetic effect is that progress output remains visible after completion on Windows (not erased). No functional impact.

Tests

Added tests/test_live_transient_windows.py with 5 tests:

  • 3 runtime tests that intercept the Live constructor via select_with_arrows() and verify the correct transient kwarg under patched sys.platform (win32, linux, darwin)
  • 2 source-level regression guards verifying both the platform check and transient=_transient usage exist in both files

mnriem avatar Jun 11 '26 13:06 mnriem