fix: 二次 Apply 不再误报 #26/#27,重启等到会话树落地再进页面

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yangandCursor committed 2026-09-17 13:33:34 +08:00
1 parent 6c88f4d075
commit fd4dfa4e38
11 files changed
+254 -432

No files matched your search

+2 -5
View File
@@ -1,4 +1,3 @@
// Spawned by /dsh-purge/restart: wait until the old web port is free, then relaunch.
import net from "node:net";
import { spawn } from "node:child_process";
import { envForDetachedSpawn } from "./core.js";
@@ -37,8 +36,7 @@ async function waitFree() {
const ok = await waitFree();
if (!ok) process.exit(1);
// On Windows, detached without a hidden console allocates a visible conhost.
// Always force windowsHide + never shell (dsh.cmd → cmd.exe flash).
// detached + windowsHide;shell:false 避免再走 dsh.cmd / cmd.exe。
const child = spawn(info.execPath, info.argv, {
detached: true,
stdio: "ignore",
@@ -49,7 +47,6 @@ const child = spawn(info.execPath, info.argv, {
});
child.on("error", () => process.exit(1));
child.unref();
// Brief linger so the replacement is not torn down with this helper's process
// group on Windows before it detaches.
// 等子进程脱离 job,避免 helper 退出时带走新进程。
await new Promise((r) => setTimeout(r, 400));
process.exit(0);