mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 16:00:43 +00:00
修 --quiet 卸载日志的两个问题(静态检查抓出来的)
1. run_agent.py 用了 Path 但没导入
静态检查报 "undefined name 'Path'"。它被 try/except 吞了,
所以卸载功能本身没坏,但**日志从来没写成过** ——
属于"看着没事、其实功能是死的",最容易被漏掉的那种。
2. 日志写到刚被删掉的数据目录里
原来是 Path(data_dir())/"uninstall.log",但 do_uninstall()
会把整个数据目录删掉,写完等于白写。
改到 %TEMP%\ykxmz-uninstall.log。
现在日志能正常落盘,内容长这样:
开始卸载 ykxmz
已停止其它 ykxmz.exe 实例(本进程 15572 除外)
没有开机自启项
已删除数据目录 ...
程序目录交给安装包的卸载器删除
卸载完成。
最终全量套件(33 个阶段):
30 PASS + 3 SKIP(锁屏) + 0 FAIL
新增的「安装包完整周期」PASS
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
r'''提交最后的两个修复。'''
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||||
GIT = r"C:\Program Files\Git\bin\git.exe"
|
||||
|
||||
MSG = """修 --quiet 卸载日志的两个问题(静态检查抓出来的)
|
||||
|
||||
1. run_agent.py 用了 Path 但没导入
|
||||
静态检查报 "undefined name 'Path'"。它被 try/except 吞了,
|
||||
所以卸载功能本身没坏,但**日志从来没写成过** ——
|
||||
属于"看着没事、其实功能是死的",最容易被漏掉的那种。
|
||||
|
||||
2. 日志写到刚被删掉的数据目录里
|
||||
原来是 Path(data_dir())/"uninstall.log",但 do_uninstall()
|
||||
会把整个数据目录删掉,写完等于白写。
|
||||
改到 %TEMP%\\ykxmz-uninstall.log。
|
||||
|
||||
现在日志能正常落盘,内容长这样:
|
||||
开始卸载 ykxmz
|
||||
已停止其它 ykxmz.exe 实例(本进程 15572 除外)
|
||||
没有开机自启项
|
||||
已删除数据目录 ...
|
||||
程序目录交给安装包的卸载器删除
|
||||
卸载完成。
|
||||
|
||||
最终全量套件(33 个阶段):
|
||||
30 PASS + 3 SKIP(锁屏) + 0 FAIL
|
||||
新增的「安装包完整周期」PASS
|
||||
"""
|
||||
|
||||
|
||||
def main() -> int:
|
||||
subprocess.run([GIT, "add", "-A"], cwd=str(ROOT), check=False)
|
||||
msg_file = ROOT / "_build" / "_cmsg5.txt"
|
||||
msg_file.write_bytes(MSG.encode("utf-8"))
|
||||
r = subprocess.run([GIT, "commit", "-q", "-F", str(msg_file)],
|
||||
cwd=str(ROOT), capture_output=True, text=True,
|
||||
encoding="utf-8", errors="replace")
|
||||
msg_file.unlink(missing_ok=True)
|
||||
print(" commit exit=%s" % r.returncode)
|
||||
show = subprocess.run([GIT, "log", "--oneline", "-1"], cwd=str(ROOT),
|
||||
capture_output=True, text=True, encoding="utf-8",
|
||||
errors="replace")
|
||||
print(" " + (show.stdout or "").strip())
|
||||
env = dict(os.environ)
|
||||
env["GIT_SSH_COMMAND"] = r'"C:\Program Files\Git\usr\bin\ssh.exe"'
|
||||
push = subprocess.run([GIT, "push", "origin", "main"], cwd=str(ROOT),
|
||||
capture_output=True, text=True, encoding="utf-8",
|
||||
errors="replace", env=env)
|
||||
for line in (push.stderr or push.stdout or "").strip().splitlines()[-2:]:
|
||||
print(" " + line)
|
||||
status = subprocess.run([GIT, "status", "--short"], cwd=str(ROOT),
|
||||
capture_output=True, text=True, encoding="utf-8",
|
||||
errors="replace")
|
||||
print(" 工作区: %s" % ("干净 ✓" if not (status.stdout or "").strip()
|
||||
else (status.stdout or "").strip()[:160]))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user