























@@ -113,9 +113,44 @@ describe("entry compile cache", () => {
113113NODE_DISABLE_COMPILE_CACHE: "1",
114114OPENCLAW_COMPILE_CACHE_DISABLED_RESPAWNED: "1",
115115},
116+detachForProcessTree: true,
116117});
117118});
118119120+it("keeps interactive no-cache respawn plans attached to the terminal", async () => {
121+const root = makeTempDir(tempDirs, "openclaw-compile-cache-interactive-");
122+const entryFile = path.join(root, "dist", "entry.js");
123+await fs.mkdir(path.join(root, "src"), { recursive: true });
124+await fs.writeFile(path.join(root, "src", "entry.ts"), "export {};\n", "utf8");
125+126+const plan = buildOpenClawCompileCacheRespawnPlan({
127+currentFile: entryFile,
128+env: { NODE_COMPILE_CACHE: "/tmp/openclaw-cache" },
129+execPath: "/usr/bin/node",
130+installRoot: root,
131+argv: ["/usr/bin/node", entryFile, "tui"],
132+});
133+134+expect(plan?.detachForProcessTree).toBe(false);
135+});
136+137+it("keeps bare-root no-cache respawn plans attached to the terminal", async () => {
138+const root = makeTempDir(tempDirs, "openclaw-compile-cache-root-");
139+const entryFile = path.join(root, "dist", "entry.js");
140+await fs.mkdir(path.join(root, "src"), { recursive: true });
141+await fs.writeFile(path.join(root, "src", "entry.ts"), "export {};\n", "utf8");
142+143+const plan = buildOpenClawCompileCacheRespawnPlan({
144+currentFile: entryFile,
145+env: { NODE_COMPILE_CACHE: "/tmp/openclaw-cache" },
146+execPath: "/usr/bin/node",
147+installRoot: root,
148+argv: ["/usr/bin/node", entryFile],
149+});
150+151+expect(plan?.detachForProcessTree).toBe(false);
152+});
153+119154it("does not respawn unaffected packaged installs when NODE_COMPILE_CACHE is configured", () => {
120155const root = makeTempDir(tempDirs, "openclaw-compile-cache-package-respawn-");
121156@@ -152,6 +187,7 @@ describe("entry compile cache", () => {
152187NODE_DISABLE_COMPILE_CACHE: "1",
153188OPENCLAW_COMPILE_CACHE_DISABLED_RESPAWNED: "1",
154189},
190+detachForProcessTree: false,
155191});
156192});
157193@@ -184,6 +220,7 @@ describe("entry compile cache", () => {
184220command: "/usr/bin/node",
185221args: ["/repo/openclaw/dist/entry.js", "status"],
186222env: { NODE_DISABLE_COMPILE_CACHE: "1" },
223+detachForProcessTree: true,
187224},
188225{
189226spawn: spawn as unknown as typeof import("node:child_process").spawn,
@@ -199,6 +236,8 @@ describe("entry compile cache", () => {
199236{
200237stdio: "inherit",
201238env: { NODE_DISABLE_COMPILE_CACHE: "1" },
239+detached:
240+process.platform !== "win32" && !(process.stdin.isTTY || process.stdout.isTTY),
202241},
203242);
204243const [bridgeChild, bridgeOptions] = requireFirstMockCall(
@@ -224,6 +263,7 @@ describe("entry compile cache", () => {
224263command: "/usr/bin/node",
225264args: ["/repo/openclaw/dist/entry.js"],
226265env: {},
266+detachForProcessTree: true,
227267},
228268{
229269spawn: spawn as unknown as typeof import("node:child_process").spawn,
@@ -253,6 +293,7 @@ describe("entry compile cache", () => {
253293command: "/usr/bin/node",
254294args: ["/repo/openclaw/dist/entry.js"],
255295env: {},
296+detachForProcessTree: false,
256297},
257298{
258299spawn: spawn as unknown as typeof import("node:child_process").spawn,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。