fix: Ubuntu守护进程配置兼容性 - 审查修复#550
Open
fanzifeng wants to merge 2 commits intojiulingyun:mainfrom
Open
Conversation
- 改进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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
官方审查问题修复
修复 #543 的全部 8 个问题:
1. 类型错误 (已修复)
detectUbuntuIssue返回类型添加缺失的pattern?: string和value?: string字段2. 死代码 (已修复)
getLinuxServiceInstallGuide(),detectUbuntuIssue(),getDetailedSystemdHints()3. service.ts 与 systemd-hints.ts 逻辑重复 (已修复)
buildInstallErrorMessage()作为唯一来源service.tsinstall 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-release7. 多行 error message 用 \n 拼接 (已修复)
数组 .join("\n")8. Squash 成干净提交 (已修复)
变更统计: +486 / -264
Closes #543