cicy-desktop 2.1.187 → 2.1.189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -444,16 +444,25 @@ function register({ sidecarLogPath } = {}) {
|
|
|
444
444
|
} catch {}
|
|
445
445
|
}, 500);
|
|
446
446
|
const child = await sidecar.start({ logPath: sidecarLogPath, force: false, emit });
|
|
447
|
+
// start() 返回 null = ensureEnv 失败(node/brew/tmux 没装成,emit 已说原因)或没 spawn 成。
|
|
448
|
+
// **立刻报错返回**,别进 6 分钟干等(否则 child 一直是 null、break 条件永不成立,drawer 卡在
|
|
449
|
+
// 「进行中」、不翻 error、不出重试按钮 —— 主人实测的 bug)。
|
|
450
|
+
if (!child) {
|
|
451
|
+
clearInterval(tail);
|
|
452
|
+
if (await sidecar.probeExisting(PORT)) { emit({ phase: "done", status: "done", message: "cicy-code 已就绪 :8008" }); return { ok: true }; }
|
|
453
|
+
emit({ phase: "done", status: "error", message: "❌ 环境准备失败(见上方日志),修好后点「重试」" });
|
|
454
|
+
return { ok: false, error: "环境准备失败 — 见安装日志" };
|
|
455
|
+
}
|
|
447
456
|
// Node 下载 + cicy-code 首次 brew 装依赖很慢 → 等到 ~6 分钟;子进程退出(失败)立即停手。
|
|
448
457
|
let up = false;
|
|
449
458
|
for (let i = 0; i < 720; i++) {
|
|
450
459
|
if (await sidecar.probeExisting(PORT)) { up = true; break; }
|
|
451
|
-
if (child
|
|
460
|
+
if (child.exitCode != null) break;
|
|
452
461
|
await new Promise((r) => setTimeout(r, 500));
|
|
453
462
|
}
|
|
454
463
|
clearInterval(tail);
|
|
455
464
|
if (up) { emit({ phase: "done", status: "done", message: "cicy-code 已就绪 :8008" }); return { ok: true, pid: child?.pid || null }; }
|
|
456
|
-
if (child
|
|
465
|
+
if (child.exitCode != null) { emit({ phase: "done", status: "error", message: `cicy-code 启动失败(exit=${child.exitCode}),见上方日志` }); return { ok: false, error: `cicy-code exited (${child.exitCode}) — 见安装日志` }; }
|
|
457
466
|
return { ok: true, pid: child?.pid || null, warning: "6 分钟内未就绪(可能还在装依赖,见日志)" };
|
|
458
467
|
} catch (err) {
|
|
459
468
|
emit({ phase: "done", status: "error", message: `启动失败:${err.message}` });
|
package/src/sidecar/cicy-code.js
CHANGED
|
@@ -115,10 +115,11 @@ function brewInstallStream(brew, dep, env, e) {
|
|
|
115
115
|
// 返回 { nodeBinDir, registry } 或 null(失败,drawer 已 emit 原因 + 可重试)。
|
|
116
116
|
async function ensureEnv({ emit } = {}) {
|
|
117
117
|
const e = emit || (() => {});
|
|
118
|
-
// 1)
|
|
118
|
+
// 1) 检查网络是否为 CN → 选 registry + bottle 镜像
|
|
119
|
+
e({ phase: "net", status: "running", message: `检查网络是否为 CN…` });
|
|
119
120
|
const cn = process.env.CICY_NPM_REGISTRY ? true : await probeIsCN();
|
|
120
121
|
const registry = process.env.CICY_NPM_REGISTRY || (cn ? "https://registry.npmmirror.com" : "https://registry.npmjs.org");
|
|
121
|
-
e({ phase: "net", status: "running", message:
|
|
122
|
+
e({ phase: "net", status: "running", message: `网络:${cn ? "CN" : "非 CN"} → registry=${registry.replace(/^https?:\/\//, "")}${cn ? " + 镜像加速" : ""}` });
|
|
122
123
|
|
|
123
124
|
// 2) Node(系统 ≥20 用,否则装 Node 24)
|
|
124
125
|
const nodeBinDir = await ensureNode({ emit });
|