why realRunInstaller has a windows way to run the command if we check at root that if windows, just print update and exit?
Searched for 1 pattern, read 1 file
It doesn't need to — you've found dead code, and the comment on it admits as much ("the cmd.exe branch below is unreachable today. It is kept as cover for Windows print-only being lifted later").
Verified unreachable, two ways:
- realRunInstaller is only ever reached through the runInstaller seam, which MaybeAutoUpdate calls in exactly one place — the autoUpdateActionUpdate arm — and Windows returns before that.
- Every test overrides the seam (autoupdate_test.go:31, versioncheck_test.go:730), so realRunInstaller isn't called in tests either. The goos == goosWindows branch has zero coverage and no caller on any platform.
But the more interesting part is that the branch wouldn't work if it were reached, so it's not the safety net it claims to be. Look at what UpdateCommandForCurrentBinary actually returns on Windows, run through cmd /C:
┌─────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────┐
│ Command │ Through cmd.exe │
├─────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┤
│ irm …install.ps1 -UseBasicParsing | iex │ breaks — cmd treats | as its own pipe, and irm/iex are PowerShell cmdlets, not cmd commands │
├─────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┤
│ & ([scriptblock]::Create((irm …))) -Channel nightly │ breaks — leading & is a cmd command separator; syntax error │
├─────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┤
│ cmd.exe /D /C "scoop install … && …" │ works, but double-nested cmd /C cmd /C │
├─────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┤
│ mise upgrade entire │ works │
└─────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────┘
So half of the Windows commands are PowerShell one-liners that cmd.exe cannot run at all. This is also precisely the pattern CLAUDE.md bans — a dynamic value interpolated onto a cmd.exe line — and the install.ps1 URL case is the exact shape of the entire login bug that rule was written for.
Whoever lifts Windows print-only needs powershell -NoProfile -Command (or, better, the in-process rename-and-replace from the research above, no shell at all). Dead code that looks like cover but silently mangles two of four commands is worse than no code: the next person reads the comment, trusts it, deletes the early return, and ships a broken updater.