test(desktop-update): a hand-off log read racing Add-Content retries, not fails

test_script_killed_before_publishing_the_delegate_runs_no_update failed on
the Windows arm64 lane with PermissionError reading
logs/desktop-update-handoff.log: windows.ps1 appends each line with
Add-Content, and a poll that lands while that write holds the file is a
Windows sharing violation, not a missing line. The poll helper now
retries the read (5 s budget) instead of failing the test on it.
Same test is green on main's latest arm64 run; nothing in this PR
touches the desktop-update scripts.
This commit is contained in:
Teknium
2026-10-07 05:15:08 -07:00
parent b8f007cc4f
commit 062dffab26

View File

@@ -88,8 +88,16 @@ def _op(home: Path, *args: str) -> tuple[int, str, str]:
def _log(home: Path) -> str:
"""The hand-off log so far. windows.ps1 appends with Add-Content, which holds the file without
read sharing for the length of each write: a read landing in that window is a sharing
violation (PermissionError), not a missing line, so it is retried."""
path = home / 'logs/desktop-update-handoff.log'
return path.read_text(encoding='utf-8-sig') if path.exists() else ''
for _ in range(50):
try:
return path.read_text(encoding='utf-8-sig') if path.exists() else ''
except PermissionError:
time.sleep(0.1)
return path.read_text(encoding='utf-8-sig')
def _custodian(home: Path, handoff: int) -> str: