
























@@ -147,6 +147,57 @@ describe("bundled plugin postinstall", () => {
147147);
148148});
149149150+it("does not warn when compile-cache pruning hits EACCES or EPERM (shared caches)", () => {
151+const base = path.join("/tmp", "openclaw-shared-compile-cache");
152+const dirA = path.join(base, "v22.13.1-x64-efe9a9df-1001");
153+const dirB = path.join(base, "v22.13.1-x64-efe9a9df-1002");
154+const warn = vi.fn();
155+const rmSync = vi.fn((value: string) => {
156+if (value === dirA) {
157+throw Object.assign(new Error(`permission denied pruning ${value}`), { code: "EACCES" });
158+}
159+if (value === dirB) {
160+throw Object.assign(new Error(`operation not permitted pruning ${value}`), {
161+code: "EPERM",
162+});
163+}
164+});
165+166+pruneOpenClawCompileCache({
167+env: { NODE_COMPILE_CACHE: base },
168+existsSync: vi.fn((value: string) => value === base),
169+readdirSync: vi.fn(() => [
170+{ name: path.basename(dirA), isDirectory: () => true },
171+{ name: path.basename(dirB), isDirectory: () => true },
172+]),
173+ rmSync,
174+log: { warn },
175+});
176+177+expect(rmSync).toHaveBeenCalledTimes(2);
178+expect(warn).not.toHaveBeenCalled();
179+});
180+181+it("does not warn when the compile-cache base directory cannot be listed (EACCES)", () => {
182+const base = path.join("/tmp", "openclaw-compile-cache-no-list");
183+const warn = vi.fn();
184+const rmSync = vi.fn();
185+const err = Object.assign(new Error(`EACCES: ${base}`), { code: "EACCES" });
186+187+pruneOpenClawCompileCache({
188+env: { NODE_COMPILE_CACHE: base },
189+existsSync: vi.fn(() => true),
190+readdirSync: vi.fn(() => {
191+throw err;
192+}),
193+ rmSync,
194+log: { warn },
195+});
196+197+expect(rmSync).not.toHaveBeenCalled();
198+expect(warn).not.toHaveBeenCalled();
199+});
200+150201it("does not classify published packages with source files as source checkouts", () => {
151202const packageRoot = "/pkg";
152203const existingPaths = new Set([
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。