diff --git a/emrg/_stop_all.py b/emrg/_stop_all.py index 7dcecfd3..b65106b1 100644 --- a/emrg/_stop_all.py +++ b/emrg/_stop_all.py @@ -58,7 +58,7 @@ # Build stamp printed at the start of every run so the operator can tell at a # glance which stop_all.py generation executed (rant 2026-08-17T21:06:31). -_STOP_ALL_STAMP = "built 2026-08-18 (isolated -I + module-holder enumeration + createfile-probe + taskkill RM + self-lock guard)" +_STOP_ALL_STAMP = "built 2026-08-18 (module-holder enumeration + createfile-probe + taskkill RM + excluded-chain self-exclusion + self-lock guard)" _EMRG_CLIENT_RE = re.compile(r"-m\s+emrg(\.server)?(\s|$)") _APPIMAGE_RE = re.compile(r"EMRG-[\w.\-]*AppImage(\s|$)") diff --git a/packaging/make-installer.sh b/packaging/make-installer.sh index f89c1385..eaefc46f 100755 --- a/packaging/make-installer.sh +++ b/packaging/make-installer.sh @@ -406,11 +406,14 @@ begin // (列出杀不掉的进程),宿主不再需要手动跑诊断。 // cmd 引号嵌套:外层 /c "...",内层脚本路径用双引号包裹,重定向在外、 // 仍在内层引号外(SW_HIDE 隐藏窗口后 stdout/stderr 经 > log 2>&1 落盘)。 - // -I(isolated mode,rant 2026-08-18T16:09:45):忽略 PYTHONPATH / site-packages / - // .pth / ._pth,纯标准库即可跑 —— python-dist 的 site 配置不再加载 install\lib 的 - // websockets → 不再自锁要删的 speedups pyd(v0.2.48 DeleteFile code 5 根因2)。 + // -I(isolated mode,v0.2.50 引入)已移除(rants 2026-08-18T21:13:03 / 21:14:16): + // python-build-standalone 定位 stdlib 依赖目录结构 / ._pth 机制,-I 忽略之 → + // v0.2.50 Windows 安装 "Failed to import encodings" 启动即崩(连 stop_all.log 都没有)。 + // -I 防的"自锁"假设已被证伪:stop_all 的 excluded-chain 已排除自身 + 祖先进程链 + // (从不杀自己),#847 self-held 归属已处理自身锁,且 stop_all 纯标准库从不加载 + // websockets。恢复 v0.2.49 的 "{PythonExe}" "{StopScript}",无需任何替代 flag。 LogFile := ExpandConstant('{tmp}\stop_all.log'); - if Exec(ExpandConstant('{cmd}'), '/c ""' + PythonExe + '" -I "' + StopScript + '" > "' + LogFile + '" 2>&1"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then + if Exec(ExpandConstant('{cmd}'), '/c ""' + PythonExe + '" "' + StopScript + '" > "' + LogFile + '" 2>&1"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then begin if ResultCode <> 0 then begin diff --git a/tests/test_installer_stop.py b/tests/test_installer_stop.py index 10b7ffc0..be10c78e 100644 --- a/tests/test_installer_stop.py +++ b/tests/test_installer_stop.py @@ -259,11 +259,14 @@ def test_make_installer_iss_has_prepare_to_install(): assert "stop_all.log" in content assert '''" > "' + LogFile + '" 2>&1"''' in content assert content.count("2>&1") >= 1 - # rant 2026-08-18T16:09:45 — python-dist 的 site 配置会加载 install\lib 模块 - # (websockets → speedups pyd)→ stop_all 自锁要删的文件。修复 = -I isolated - # mode(忽略 PYTHONPATH/site-packages/.pth/._pth,纯标准库即可跑)。 - assert '''""' + PythonExe + '" -I "' + StopScript''' in content - assert "isolated mode" in content + # rants 2026-08-18T21:13:03 / 21:14:16 — 移除 -I isolated mode: + # python-build-standalone 靠目录结构 / ._pth 定位 stdlib,-I 忽略之 → + # v0.2.50 Windows 安装 "Failed to import encodings" 启动即崩(无 stop_all.log)。 + # -I 防的"自锁"假设被证伪:excluded-chain 已排除自身 + 祖先进程链(从不杀自己), + # #847 self-held 归属已处理自身锁,且 stop_all 纯标准库从不加载 websockets。 + # 恢复 v0.2.49 的 "{PythonExe}" "{StopScript}",无替代 flag。 + assert '''""' + PythonExe + '" "' + StopScript''' in content + assert '''""' + PythonExe + '" -I "' + StopScript''' not in content # ⚡ LoadStringFromFile 的 Inno Pascal Script 签名是 2 参数 out-param 形式 assert "LoadStringFromFile(LogFile, LogText)" in content # 正:out-param 形式 assert ":= LoadStringFromFile(LogFile)" not in content # 反:1 参数形式不存在