Skip to content

fix: Ubuntu守护进程配置兼容性 - 审查修复#550

Open
fanzifeng wants to merge 2 commits intojiulingyun:mainfrom
fanzifeng:pr-543
Open

fix: Ubuntu守护进程配置兼容性 - 审查修复#550
fanzifeng wants to merge 2 commits intojiulingyun:mainfrom
fanzifeng:pr-543

Conversation

@fanzifeng
Copy link
Copy Markdown

官方审查问题修复

修复 #543 的全部 8 个问题:

1. 类型错误 (已修复)

  • detectUbuntuIssue 返回类型添加缺失的 pattern?: stringvalue?: string 字段

2. 死代码 (已修复)

  • 删除 getLinuxServiceInstallGuide(), detectUbuntuIssue(), getDetailedSystemdHints()

3. service.ts 与 systemd-hints.ts 逻辑重复 (已修复)

  • 统一错误构建:buildInstallErrorMessage() 作为唯一来源
  • service.ts install catch 块改为调用 buildInstallErrorMessage()
  • renderSystemdUnavailableHints() 支持按发行版返回针对性提示

4. assertSystemdAvailable 双重调用 execSystemctl (已修复)

  • 新增 parseSystemctlFailure() 内部辅助函数
  • assertSystemdAvailable() 复用第一次 execSystemctl 结果,不再重复调用

5. 缺少测试 (已修复)

  • 新增覆盖:isSystemdUserServiceAvailableDetailed (6个场景)
  • 新增覆盖:isSystemdUnavailableDetail (5个场景)
  • 新增覆盖:detectLinuxDistro (3个场景)
  • 新增覆盖:renderSystemdUnavailableHints (5个场景)
  • 新增覆盖:buildInstallErrorMessage (5个场景)
  • 新增覆盖:isWSLEnv (3个场景)

6. Ubuntu 检测方式不可靠 (已修复)

  • 新增 detectLinuxDistro() 读取标准 /etc/os-release
  • 支持 ID + ID_LIKE 双字段,支持 Pop!_OS 等衍生发行版

7. 多行 error message 用 \n 拼接 (已修复)

  • 全部改用 数组 .join("\n")

8. Squash 成干净提交 (已修复)

  • 全部 commit squash 成一个干净的修复提交

变更统计: +486 / -264

Closes #543

范子慷 and others added 2 commits April 1, 2026 10:08
- 改进systemd检测逻辑,提供详细的错误信息
- 添加Ubuntu特定错误检测和修复指导
- 增强错误处理,提供具体修复步骤
- 添加多种替代运行方案
- 保持向后兼容性
- 添加Linux服务安装指南函数
- 修复类型错误: detectUbuntuIssue 返回类型添加 pattern/value 字段
- 删除死代码: getLinuxServiceInstallGuide, detectUbuntuIssue, getDetailedSystemdHints
- 统一错误逻辑: service.ts 与 systemd-hints.ts 逻辑合并
- 改进发行版检测: 使用 /etc/os-release 替代 env.OS/DISTRIB_ID
- 修复双重 execSystemctl 调用: assertSystemdAvailable 复用第一次结果
- 改进错误消息: 全部改用数组 .join('\n') 替代字符串 \n 拼接
- 补充测试: 覆盖 isSystemdUserServiceAvailableDetailed,
  renderSystemdUnavailableHints, isSystemdUnavailableDetail, detectLinuxDistro,
  buildInstallErrorMessage, isWSLEnv
@fanzifeng fanzifeng changed the title fix: Ubuntu守护进程配置兼容性 - 官方审查全部修复 fix: Ubuntu守护进程配置兼容性 - 审查修复 Apr 18, 2026
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.

1 participant