Skip to content

fix(wsl): 注册表读版本,并拆分 SDK 安装模块 - #14

Merged
cursor[bot] merged 5 commits into
mainfrom
cursor/wsl-version-registry-27c9
Oct 12, 2026
Merged

cursor[bot] merged 5 commits into
mainfrom
cursor/wsl-version-registry-27c9

Conversation

@timeroute

@timeroute timeroute commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

背景

启动门禁不应再跑 wsl --version。Service::version() 要等 DLL 加载后才能用;WSL 包版本在注册表。原先 CLI 解析和臃肿安装逻辑可删。

改动

  • 只读注册表 HKLM\...\Lxss\Msi\Version;缺键 = 未安装。无 CLI。
  • 拆分:wsl_probe / sdk_cache / sdk_fetch。
  • 精简 sdk_version:删除 UTF-16/多行解析;只留 SemVer + NuGet 匹配。
  • 清理死代码:未使用的 session_stats / SessionStats / Cmd::Stats;去掉多余 host_version 包装。
  • 会话建立后仍用 Service::version()。

体量(约)

文件 行数
sdk_version.rs ~177
wsl_probe.rs ~84
sdk_cache.rs ~79
sdk_fetch.rs ~289

测试

  • cargo test --bin wslc-desktop 14 passed
  • RUSTFLAGS="-W unused -W dead_code" cargo build 无 warning
Open in Web Open in Cursor 

cursoragent and others added 2 commits October 11, 2026 11:39
Prefer HKLM Lxss\Msi\Version (same source WSL uses) so setup
does not spawn wsl.exe before wslcsdk.dll is available.
Keep CLI only as fallback; live SDK still uses Service::version.

Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
Keep ensure_sdk_dir as cache-hit → list → download. Move registry/CLI
probing and stamp/DLL paths out so the fetch module stays focused.

Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
@cursor cursor Bot changed the title fix(wsl): 优先从注册表读取 WSL 版本 fix(wsl): 注册表读版本,并拆分 SDK 安装模块 Oct 11, 2026
cursoragent and others added 3 commits October 11, 2026 11:46
WSL 2.9.3+ always writes Lxss\Msi\Version; missing key means
not installed. Removes wsl.exe spawn and UTF-16 pipe path.

Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
Registry already yields x.y.z[.w]; keep SemVer, package gate,
and NuGet matching only.

Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
Drop SessionStats/Cmd::Stats and the unused host_version wrapper.
Refresh SDK notes and silence Linux-only dead_code false positives.

Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
@cursor
cursor Bot marked this pull request as ready for review October 12, 2026 00:56
@cursor
cursor Bot merged commit 5d1b313 into main Oct 12, 2026
1 check passed
@timeroute
timeroute deleted the cursor/wsl-version-registry-27c9 branch October 12, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants