Skip to content

fix: 修复安装脚本静默退出并增强错误提示#107

Merged
openleek merged 4 commits into
mainfrom
fix/install-sigpipe
Mar 19, 2026
Merged

fix: 修复安装脚本静默退出并增强错误提示#107
openleek merged 4 commits into
mainfrom
fix/install-sigpipe

Conversation

@larryro

@larryro larryro commented Mar 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 修复 set -euo pipefail 下密码生成 tr | head 触发 SIGPIPE 导致首次安装静默退出
  • 修复 Detect_Version 中 API 限流时 grep 无匹配导致静默退出
  • 修复 Detect_Target_Host 中管道失败导致静默退出
  • 添加全局 ERR + EXIT trap,安装失败时显示具体出错命令、行号、退出码和日志路径

Test plan

  • 首次安装验证密码正常生成,安装流程完整执行
  • 模拟 GitHub API 限流,验证显示 "获取最新版本失败" 而非静默退出
  • 模拟任意步骤失败,验证用户能看到错误详情

larryro and others added 4 commits March 19, 2026 21:15
在 set -euo pipefail 下,tr /dev/urandom | head 会因 SIGPIPE 返回退出码 141,
导致首次安装时脚本在密码生成步骤静默终止,后续所有安装步骤均未执行。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
当 GitHub API 被限流或返回异常响应时,grep 匹配不到 tag_name 返回退出码 1,
pipefail + set -e 导致脚本静默退出,无法显示 "获取最新版本失败" 的错误提示。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
之前 set -euo pipefail 导致任何未处理的错误都会静默退出,
用户完全看不到发生了什么。现在在 EXIT trap 中检测退出码,
异常退出时显示错误提示和日志路径。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
通过 ERR trap 捕获失败命令的详细信息,在 EXIT trap 中展示给用户,
方便定位问题。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@larryro larryro changed the title fix: 修复安装脚本因 SIGPIPE 静默退出的问题 fix: 修复安装脚本静默退出并增强错误提示 Mar 19, 2026
@larryro larryro requested a review from openleek March 19, 2026 13:33
@openleek openleek merged commit 8649f2e into main Mar 19, 2026
5 checks passed
@openleek openleek deleted the fix/install-sigpipe branch March 19, 2026 14:25
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