Commit Graph

2 Commits (47f8bc69d9af0f38204d519d18a2bdc9c1a69847)

Author SHA1 Message Date
mula.liu 47f8bc69d9 fix(runtime): make the one-click component install work on Windows
Reported: "在windows机器上实测一键安装组件会失败." Four independent
defects hid inside the same ten lines of `install_target_package`:

- `winget`'s benign codes — 0x8A15002B already installed, 0x8A150016 no
  upgrade applicable — were read as failures, so a machine that already
  had the tool was guaranteed to be told the install failed.
- `--source` was never pinned, so on a host that also carries msstore
  `winget` could block on a source agreement `--silent` never answers,
  and the 15-minute deadline turned a hang into the same failure.
- Machine-level packages (Poppler, FFmpeg, ImageMagick, Typst) install
  into Program Files and need admin, and Shift is an unelevated GUI
  process. There was no elevation path at all.
- Post-install verification could not succeed even when the install did:
  a process keeps the environment block it was launched with, so the
  WinGet Links directory written to the registry never reached the live
  `which` lookup.

Attempts now run unscoped, then `--scope user`, then elevated machine
scope, and success is decided by whether the binary is on disk after the
process PATH has been re-read. The four outcomes a user can act on —
declined prompt, installed-but-not-on-PATH, no package source, timeout —
each say so in both languages instead of "安装失败".

Co-Authored-By: Codex <noreply@openai.com>
2026-11-19 17:46:52 +08:00
mula.liu c6eff4e131 修复bug 2026-10-25 12:24:05 +08:00