Windows Updater Infinite Loop Fix (#69)
Fixed — Updater enters infinite loop with 100% CPU on Windows
- Replaced
timeout /twithpingdelay — The deferred update.batscript usedtimeout /t 1 /nobreakfor delays. On Windows systems with GNU coreutils in PATH (Git Bash, Cygwin, MSYS2), the GNUtimeoutbinary takes precedence over the Windows built-in, fails instantly with "invalid time interval '/t'", and causes a tight retry loop at 100% CPU. Now usesping 127.0.0.1 -n 2 >nulwhich works on every Windows system regardless of PATH. - Added retry limit (60 attempts) — The script now exits with an error message after 60 failed attempts (~60 seconds) instead of looping indefinitely. Cleans up the pending binary on timeout.
- Extracted
generate_update_script()as public function for testability.
Testing
- 10 new unit tests covering: no
timeoutcommand usage,pingdelay, retry limit, counter increment, timeout exit, pending file cleanup, path substitution (incl. spaces), batch syntax validity, rollback on failure. - All 669 tests passing, zero clippy warnings.
Upgrade
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxFull Changelog: v2.21.5...v2.21.5