Skip to content

Commit b796890

Browse files
committed
test(sdk): resolve Windows package taskkill path
1 parent b5fc951 commit b796890

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/sdk/src/package.e2e.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import os from "node:os";
77
import path from "node:path";
88
import { afterEach, describe, expect, it, vi } from "vitest";
99
import { createPnpmRunnerSpawnSpec } from "../../../scripts/pnpm-runner.mjs";
10+
import { getWindowsSystem32ExePath } from "../../../src/infra/windows-install-roots.js";
1011
import { createNodeEvalArgs } from "../../../src/test-utils/node-process.js";
1112

1213
type CommandResult = {
@@ -100,12 +101,13 @@ function signalCommandProcess(
100101
if (signal === "SIGKILL") {
101102
args.push("/F");
102103
}
103-
const result = runTaskkill("taskkill", args, { stdio: "ignore", windowsHide: true });
104+
const taskkillPath = getWindowsSystem32ExePath("taskkill.exe");
105+
const result = runTaskkill(taskkillPath, args, { stdio: "ignore", windowsHide: true });
104106
if (!result.error && result.status === 0) {
105107
return;
106108
}
107109
if (signal !== "SIGKILL") {
108-
const forceResult = runTaskkill("taskkill", [...args, "/F"], {
110+
const forceResult = runTaskkill(taskkillPath, [...args, "/F"], {
109111
stdio: "ignore",
110112
windowsHide: true,
111113
});
@@ -303,11 +305,12 @@ describe("OpenClaw SDK package e2e", () => {
303305

304306
signalCommandProcess(child, "SIGTERM", runTaskkill);
305307

306-
expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], {
308+
const taskkillPath = getWindowsSystem32ExePath("taskkill.exe");
309+
expect(runTaskkill).toHaveBeenNthCalledWith(1, taskkillPath, ["/PID", "12345", "/T"], {
307310
stdio: "ignore",
308311
windowsHide: true,
309312
});
310-
expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], {
313+
expect(runTaskkill).toHaveBeenNthCalledWith(2, taskkillPath, ["/PID", "12345", "/T", "/F"], {
311314
stdio: "ignore",
312315
windowsHide: true,
313316
});

0 commit comments

Comments
 (0)