@@ -6,6 +6,7 @@ import { tmpdir } from "node:os";
66import path from "node:path" ;
77import { pathToFileURL } from "node:url" ;
88import { afterEach , describe , expect , it , vi } from "vitest" ;
9+ import { resolveWindowsTaskkillPath } from "../../scripts/lib/windows-taskkill.mjs" ;
910import {
1011 ARTIFACT_TARBALL_SCAN_MAX_ENTRIES ,
1112 assertExpectedSha256ForTest ,
@@ -24,6 +25,10 @@ import {
2425 validateOpenClawPackageSpec ,
2526} from "../../scripts/resolve-openclaw-package-candidate.mjs" ;
2627
28+ function expectedTaskkillPath ( ) : string {
29+ return resolveWindowsTaskkillPath ( ) ;
30+ }
31+
2732const tempDirs : string [ ] = [ ] ;
2833
2934type LookupAddress = { address : string ; family : number } ;
@@ -226,17 +231,27 @@ describe("resolve-openclaw-package-candidate", () => {
226231 platform : "win32" ,
227232 runTaskkill,
228233 } ) ;
229- expect ( runTaskkill ) . toHaveBeenNthCalledWith ( 1 , "taskkill" , [ "/PID" , "12345" , "/T" ] , {
230- stdio : "ignore" ,
231- } ) ;
234+ expect ( runTaskkill ) . toHaveBeenNthCalledWith (
235+ 1 ,
236+ expectedTaskkillPath ( ) ,
237+ [ "/PID" , "12345" , "/T" ] ,
238+ {
239+ stdio : "ignore" ,
240+ } ,
241+ ) ;
232242
233243 signalChildProcessTree ( child , "SIGKILL" , {
234244 platform : "win32" ,
235245 runTaskkill,
236246 } ) ;
237- expect ( runTaskkill ) . toHaveBeenNthCalledWith ( 2 , "taskkill" , [ "/PID" , "12345" , "/T" , "/F" ] , {
238- stdio : "ignore" ,
239- } ) ;
247+ expect ( runTaskkill ) . toHaveBeenNthCalledWith (
248+ 2 ,
249+ expectedTaskkillPath ( ) ,
250+ [ "/PID" , "12345" , "/T" , "/F" ] ,
251+ {
252+ stdio : "ignore" ,
253+ } ,
254+ ) ;
240255 expect ( child . kill ) . not . toHaveBeenCalled ( ) ;
241256 } ) ;
242257
@@ -255,12 +270,22 @@ describe("resolve-openclaw-package-candidate", () => {
255270 runTaskkill,
256271 } ) ;
257272
258- expect ( runTaskkill ) . toHaveBeenNthCalledWith ( 1 , "taskkill" , [ "/PID" , "12345" , "/T" ] , {
259- stdio : "ignore" ,
260- } ) ;
261- expect ( runTaskkill ) . toHaveBeenNthCalledWith ( 2 , "taskkill" , [ "/PID" , "12345" , "/T" , "/F" ] , {
262- stdio : "ignore" ,
263- } ) ;
273+ expect ( runTaskkill ) . toHaveBeenNthCalledWith (
274+ 1 ,
275+ expectedTaskkillPath ( ) ,
276+ [ "/PID" , "12345" , "/T" ] ,
277+ {
278+ stdio : "ignore" ,
279+ } ,
280+ ) ;
281+ expect ( runTaskkill ) . toHaveBeenNthCalledWith (
282+ 2 ,
283+ expectedTaskkillPath ( ) ,
284+ [ "/PID" , "12345" , "/T" , "/F" ] ,
285+ {
286+ stdio : "ignore" ,
287+ } ,
288+ ) ;
264289 expect ( child . kill ) . not . toHaveBeenCalled ( ) ;
265290 } ) ;
266291
0 commit comments