fix: 发布 1.1.39,中文 Windows 官方桌面更新不再卡在准备重启

Fixes #47

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-29 20:10:51 +08:00
1 parent 701b4188cd
commit a049e3c7d5
8 files changed
+96 -18

No files matched your search

+5 -3
View File
@@ -2,7 +2,7 @@ import os from "node:os";
import path from "node:path";
import { execFileSync, spawn } from "node:child_process";
import { fileURLToPath } from "node:url";
import { launchOfficialDesktopUpdate, pendingOfficialUpdate } from "./official-update.js";
import { isWshAscii, launchOfficialDesktopUpdate, pendingOfficialUpdate, wshLiteral } from "./official-update.js";
import { hostFs } from "./extract-asar.js";
// 无归档时用 node:fs。app.asar 还在时不能把映射出来的 resources/app 当成已经解开。
@@ -826,7 +826,7 @@ export function scheduleRestart(request, ctx) {
}
function jsString(value) {
return JSON.stringify(String(value || ""));
return wshLiteral(value);
}
function officialRestartScript(exe, asar) {
@@ -873,7 +873,9 @@ export function restartOfficialHarness() {
const asar = appAsarPath(exe);
const script = path.join(os.tmpdir(), "dsh-purge-official-restart.js");
const launcher = path.join(os.tmpdir(), "dsh-purge-official-restart.cmd");
fs.writeFileSync(script, officialRestartScript(exe, asar), "utf8");
const restartBody = officialRestartScript(exe, asar);
if (!isWshAscii(restartBody)) return { restarting: false };
fs.writeFileSync(script, restartBody, "utf8");
fs.writeFileSync(launcher, `@echo off\r\nstart "" wscript.exe //nologo //B "${script}"\r\n`, "utf8");
const child = spawn("cmd.exe", ["/d", "/c", launcher], {
detached: true,