mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-09 03:22:40 +00:00
fix(scripts): kill boundary prep trees on windows
This commit is contained in:
@@ -7,7 +7,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
createPrefixedOutputWriter,
|
||||
isArtifactSetFresh,
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
runNodeStep,
|
||||
runNodeSteps,
|
||||
runNodeStepsInParallel,
|
||||
signalNodeStep,
|
||||
} from "../../scripts/prepare-extension-package-boundary-artifacts.mjs";
|
||||
import { makeTempDir } from "../helpers/temp-dir.js";
|
||||
|
||||
@@ -123,6 +124,31 @@ describe("prepare-extension-package-boundary-artifacts", () => {
|
||||
expect(Date.now() - startedAt).toBeLessThan(abortBudgetMs);
|
||||
}, 45_000);
|
||||
|
||||
it("signals Windows node step process trees with taskkill", () => {
|
||||
const child = {
|
||||
kill: vi.fn(),
|
||||
pid: 12345,
|
||||
};
|
||||
const runTaskkill = vi.fn(() => ({ error: undefined, status: 0 }));
|
||||
|
||||
signalNodeStep(child, "SIGTERM", {
|
||||
platform: "win32",
|
||||
runTaskkill,
|
||||
});
|
||||
expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], {
|
||||
stdio: "ignore",
|
||||
});
|
||||
|
||||
signalNodeStep(child, "SIGKILL", {
|
||||
platform: "win32",
|
||||
runTaskkill,
|
||||
});
|
||||
expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], {
|
||||
stdio: "ignore",
|
||||
});
|
||||
expect(child.kill).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.runIf(process.platform !== "win32")(
|
||||
"force-kills aborted sibling step process groups",
|
||||
async () => {
|
||||
|
||||
Reference in New Issue
Block a user