



























@@ -5,7 +5,7 @@ import { access, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promise
55import { tmpdir } from "node:os";
66import path from "node:path";
77import { pathToFileURL } from "node:url";
8-import { afterEach, describe, expect, it } from "vitest";
8+import { afterEach, describe, expect, it, vi } from "vitest";
99import {
1010ARTIFACT_TARBALL_SCAN_MAX_ENTRIES,
1111assertExpectedSha256ForTest,
@@ -20,6 +20,7 @@ import {
2020readPackageBuildSourceSha,
2121resolveNpmPackageCandidatePackRunner,
2222runCommandForTest,
23+signalChildProcessTree,
2324validateOpenClawPackageSpec,
2425} from "../../scripts/resolve-openclaw-package-candidate.mjs";
2526@@ -214,6 +215,31 @@ describe("resolve-openclaw-package-candidate", () => {
214215});
215216});
216217218+it("signals Windows package runner process trees with taskkill", () => {
219+const child = {
220+kill: vi.fn(),
221+pid: 12345,
222+};
223+const runTaskkill = vi.fn(() => ({ error: undefined, status: 0 }));
224+225+signalChildProcessTree(child, "SIGTERM", {
226+platform: "win32",
227+ runTaskkill,
228+});
229+expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], {
230+stdio: "ignore",
231+});
232+233+signalChildProcessTree(child, "SIGKILL", {
234+platform: "win32",
235+ runTaskkill,
236+});
237+expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], {
238+stdio: "ignore",
239+});
240+expect(child.kill).not.toHaveBeenCalled();
241+});
242+217243it("keeps npm pack filenames inside the package candidate output directory", async () => {
218244const dir = await mkdtemp(path.join(tmpdir(), "openclaw-package-npm-pack-"));
219245tempDirs.push(dir);
@@ -688,26 +714,30 @@ describe("resolve-openclaw-package-candidate", () => {
688714const requestHeaders: Array<Record<string, string> | undefined> = [];
689715690716try {
691-await downloadUrl("https://packages.internal:8443/artifactory/openclaw/openclaw.tgz", target, {
692-fetchImpl: async (_url: URL, init?: RequestInit) => {
693-requestHeaders.push(init?.headers as Record<string, string> | undefined);
694-if (requestHeaders.length === 1) {
695-return new Response(null, {
696-headers: {
697-location: "https://mirror.internal:8443/artifactory/openclaw/openclaw.tgz",
698-},
699-status: 302,
717+await downloadUrl(
718+"https://packages.internal:8443/artifactory/openclaw/openclaw.tgz",
719+target,
720+{
721+fetchImpl: async (_url: URL, init?: RequestInit) => {
722+requestHeaders.push(init?.headers as Record<string, string> | undefined);
723+if (requestHeaders.length === 1) {
724+return new Response(null, {
725+headers: {
726+location: "https://mirror.internal:8443/artifactory/openclaw/openclaw.tgz",
727+},
728+status: 302,
729+});
730+}
731+return new Response(new Uint8Array([4, 5, 6]), {
732+headers: { "content-length": "3" },
733+status: 200,
700734});
701-}
702-return new Response(new Uint8Array([4, 5, 6]), {
703-headers: { "content-length": "3" },
704-status: 200,
705-});
735+},
736+lookupHost: lookupAddresses([{ address: "10.0.0.8", family: 4 }]),
737+maxBytes: 3,
738+ trustedSource,
706739},
707-lookupHost: lookupAddresses([{ address: "10.0.0.8", family: 4 }]),
708-maxBytes: 3,
709- trustedSource,
710-});
740+);
711741} finally {
712742if (previousToken === undefined) {
713743delete process.env.OPENCLAW_TRUSTED_PACKAGE_TOKEN;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。