mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-30 17:00:23 +08:00
fix(desktop): PowerShell 立即 kill Electron 消除 #64 crash dialog 根因
- ASAR_SWAP_PS1 不再等 WaitPid 优雅退出,改为立即 Stop-HarnessInstall; Electron main 和 host 一起被 kill,UI 来不及收 host 退出事件, main.js:3725 的"host stopped"对话框根本没机会显示。 PowerShell 是 detached+stdio:ignore 独立进程,杀 Electron 不影响自己。 - scheduleAsarSwapRestart 接 ctx fallback,启动期自愈路径也能解析 desktopRuntime 走 requestRestart 做双保险。 - gracefulExit timeout 从 4500/3000 缩到 2000/1500ms:PS 杀得快, 不需要那么长的 handoff 窗口兜底。 - core.restartSealedDesktopIfNeeded 透传 input.ctx 给桌面层两条路径。 - index.js:scheduleApplyRestart / handlePurgeCommand 全链路加 ctx 参数, commands.register handler 把 effect 作用域 ctx 交到最深处的 restartSealedDesktopIfNeeded 和 scheduleRestart。 - identity.js:isHardcodedExecRule 长度闸 800→1500,用户 rules 文件偶尔 引用写死 preamble + 本体 >800 字节时不再被误剥。
This commit is contained in:
1 parent
b17b98baa5
commit
2794ac6055
4 files changed
+51
-29
No files matched your search
+4
-1
@@ -2186,8 +2186,10 @@ export function restartSealedDesktopIfNeeded(input = {}) {
|
||||
if (!handoff?.exe || !handoff?.asar) return { needed: false, renamed: true };
|
||||
if (!asarArchiveIsFile(handoff.asar)) return { needed: false, renamed: true };
|
||||
rememberDesktopInstallForHandoff(handoff);
|
||||
// input.ctx 透传给桌面层:restartOfficialHarness 内部 desktopRuntimeOf(ctx) 拿到 runtime
|
||||
// 用于 gracefulExit 优雅握手重启,降低宿主"host 退出 = crash"弹窗概率(#64)。
|
||||
if (process.platform === "win32" && desktop.isOfficialHarnessExecutable(handoff.exe)) {
|
||||
const restarted = desktop.restartOfficialHarness({ exe: handoff.exe, asar: handoff.asar });
|
||||
const restarted = desktop.restartOfficialHarness({ exe: handoff.exe, asar: handoff.asar, ctx: input.ctx });
|
||||
return { needed: true, renamed: false, asarSwap: true, ...restarted };
|
||||
}
|
||||
desktop.scheduleAsarSwapRestart({
|
||||
@@ -2195,6 +2197,7 @@ export function restartSealedDesktopIfNeeded(input = {}) {
|
||||
asar: handoff.asar,
|
||||
waitPid: process.pid,
|
||||
exit: true,
|
||||
ctx: input.ctx,
|
||||
});
|
||||
return { needed: true, renamed: false, asarSwap: true };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user