feat(prepare-win): reboot to cmd shell before toolchain, only if needed

Up front, read Winlogon\Shell; if it isn't already cmd.exe, set it and do a
clean reboot before running the toolchain — so the shell is genuinely cmd
(not a killed-explorer half-state) for the whole servicing run. Idempotent:
when the shell is already cmd (re-runs), skip the reboot. Replaces the
earlier kill-explorer approach.
This commit is contained in:
2026-06-09 22:54:43 +02:00
parent 9c0758ceb7
commit 054bd42ff0
2 changed files with 24 additions and 10 deletions
+2
View File
@@ -434,6 +434,8 @@ def _make_transport() -> MagicMock:
def _run(script: str = "", **kwargs: object) -> WinRmResult:
if "PercentProcessorTime" in script: # pre-snapshot idle check
return WinRmResult(stdout='{"cpu":2.0,"ram":21.0,"top":"idle"}', stderr="", returncode=0)
if ").Shell" in script: # up-front shell check — already cmd, skip reboot
return WinRmResult(stdout="cmd.exe", stderr="", returncode=0)
if "ConvertTo-Json" in script:
return WinRmResult(stdout=val_json, stderr="", returncode=0)
return WinRmResult(stdout="CI_EXITCODE:0", stderr="", returncode=0)