@@ -7,6 +7,7 @@ import os from "node:os";
77import path from "node:path" ;
88import { afterEach , describe , expect , it , vi } from "vitest" ;
99import { createPnpmRunnerSpawnSpec } from "../../../scripts/pnpm-runner.mjs" ;
10+ import { getWindowsSystem32ExePath } from "../../../src/infra/windows-install-roots.js" ;
1011import { createNodeEvalArgs } from "../../../src/test-utils/node-process.js" ;
1112
1213type 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