mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 12:30:44 +00:00
修四个安装/卸载卡死的 bug(都实测复现过)
1. 卸载里 input() 在无 stdin 时永久阻塞
从控制面板卸载**永远卡住不结束**。安装包的 [UninstallRun]
用 runhidden 调用,没有 stdin,input() 就一直等。
改成只在 sys.stdin.isatty() 时才等回车。
2. Popen 没重定向子进程 stdio,导致 capture_output 等管道 EOF
_schedule_self_delete 起的 cmd 继承了父进程的 stdout/stderr 句柄,
任何用 capture_output 调 --uninstall 的地方都会一直等,
表现为"程序卡死"(实测 90 秒不返回,改后 0.2 秒)。
Popen 加 stdin/stdout/stderr=DEVNULL。
顺带把延迟从 timeout 换成 ping —— timeout 在 DETACHED_PROCESS
下没有控制台会立刻失败,等于没延迟直接删。
3. _kill_running 用 taskkill /IM ykxmz.exe 把**自己**杀了
--uninstall 本身就跑在 ykxmz.exe 里,这条命令一发,
后面的"删开机自启""删数据目录"全都没执行。
现象:卸载看着完成了,HKCU 的自启注册表项还留着。
改成 /FI "PID ne <self>" 排除自己。
4. 安装器关不掉以管理员身份运行的旧实例 -> 整个安装回滚
Inno 自带机制只会"请求"对方退出,遇上常驻的服务进程关不掉,
弹"无法自动关闭所有应用程序",静默模式下被压成"终止",
安装直接回滚 —— 用户看到的是"装了没反应/还是旧版本"。
改成 PrepareToInstall 里自己 taskkill /F,关掉 Inno 那套。
另外修了两个卸载残留:
* 安装目录留个空壳 -> [UninstallDelete] 加 dirifempty
* ProgramData\ykxmz 没删 -> 加进 [UninstallDelete]
还有一处 Inno 写法陷阱(踩了三次):
注释里写 [区段名] 或 {常量} 会让编译直接失败,
因为 [Code] 解析器连注释内容也处理。
加了 _build/check_iss.py 专门扫这个,并进全量套件。
实测结果:
静默安装 5 秒内退出,退出码 0,配对码正确写入,程序自动跑起来
静默卸载 0.7 秒退出(原来无限卡住)
全量回归 29 项全通过
卸载逻辑 11 项全通过
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
@@ -340,6 +340,26 @@ $stageOut = & python (Join-Path $root "_tests\audit_python_names.py") 2>&1
|
||||
Show-Fails $stageOut
|
||||
Record "Python 静态检查" ($LASTEXITCODE -eq 0)
|
||||
|
||||
# ---------------------------------------------------------------- 3b3
|
||||
Banner "3b3/7 安装包脚本语法(Inno 的注释陷阱)"
|
||||
# 踩过的坑:Inno 的 [Code] 解析器**连注释内容也处理**。
|
||||
# 注释里写 [区段名] 报"无效的区段标记",写 {常量} 报 "Syntax error",
|
||||
# 都是直接编译失败。这个检查专门拦这类。
|
||||
$stageOut = & python (Join-Path $root "_build\check_iss.py") 2>&1
|
||||
Show-Fails $stageOut
|
||||
Record "安装包脚本语法" ($LASTEXITCODE -eq 0)
|
||||
|
||||
# ---------------------------------------------------------------- 3b4
|
||||
Banner "3b4/7 卸载逻辑(不能杀自己 / 不能阻塞)"
|
||||
# 踩过的坑:
|
||||
# 1. taskkill /IM ykxmz.exe 把正在卸载的进程自己杀了 -> 删自启没执行
|
||||
# 2. Popen 不重定向 stdio -> capture_output 等管道 EOF -> "卡死"
|
||||
# 3. input() 在无 stdin 时永久阻塞 -> 控制面板卸载卡死
|
||||
# 4. keep_dir 缺失 -> 自删和 Inno 卸载器抢目录
|
||||
$stageOut = & python (Join-Path $root "_build\test_uninstall_logic.py") 2>&1
|
||||
Show-Fails $stageOut
|
||||
Record "卸载逻辑" ($LASTEXITCODE -eq 0)
|
||||
|
||||
# ---------------------------------------------------------------- 3b2
|
||||
Banner "3b2/7 管理页网络体检"
|
||||
# 用户看到"连不上"时最需要知道:隧道几条连接、公网通不通、延迟多少。
|
||||
|
||||
Reference in New Issue
Block a user