mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-27 20:40:22 +08:00
现象:点"应用"→ 弹"重启"对话框 → 点重启 → 弹"host stopped"崩溃对话框。 实际 PowerShell asar swap 正常启动了,只是宿主 main.js:3725 的 ChildProcess listener 把 host 子进程退出一律当"崩溃"报,并把 host stderr 全 dump 给用户看 (2026-10-09 crash log 栈顶 `at ChildProcess.<anonymous> ... main.js:3725:36` + `maybeClose` + `_handle.onexit` 就是这条路径)。 修法: 1. scheduleAsarSwapRestart 加 options.runtime(desktopRuntime 实例)。 有 runtime → 先 await runtime.requestRestart() 让宿主主动安排 restart, 宿主知道 host 会主动退就不弹 crash;setTimeout 1.8s 兜底 process.exit。 没 runtime → 兜底 process.exit 1.5s(比原 0.8s 长,给 PowerShell handoff 更多时间)。两条路径都挂日志标记 planned exit 便于排查。 2. restartOfficialHarness 加 options.ctx / options.runtime,内部 desktopRuntimeOf 拿到 runtime 后透传给 PowerShell 和 helper 两个 scheduleAsarSwapRestart 分支。 3. scheduleRestart 把 ctx 透传给 restartOfficialHarness,asar swap fallback 分支 也拿 runtime 走同一条优雅退出路径。 版本号保持 1.1.67,不发新版。