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>