@@ -11,6 +11,7 @@ import {
|
11 | 11 | decodeWindowsOutputBuffer, |
12 | 12 | resolveWindowsConsoleEncoding, |
13 | 13 | } from "../infra/windows-encoding.js"; |
| 14 | +import { getWindowsSystem32ExePath } from "../infra/windows-install-roots.js"; |
14 | 15 | import { logDebug, logError } from "../logger.js"; |
15 | 16 | import { killProcessTree as terminateProcessTree } from "./kill-tree.js"; |
16 | 17 | import { resolveCommandStdio } from "./spawn-utils.js"; |
@@ -430,8 +431,9 @@ export async function runCommandWithTimeout(
|
430 | 431 | } |
431 | 432 | if (killProcessTree && typeof child.pid === "number" && child.pid > 0) { |
432 | 433 | if (process.platform === "win32") { |
| 434 | +const taskkillPath = getWindowsSystem32ExePath("taskkill.exe"); |
433 | 435 | try { |
434 | | -spawn("taskkill", ["/PID", String(child.pid), "/T"], { |
| 436 | +spawn(taskkillPath, ["/PID", String(child.pid), "/T"], { |
435 | 437 | stdio: "ignore", |
436 | 438 | windowsHide: true, |
437 | 439 | }); |
@@ -447,7 +449,7 @@ export async function runCommandWithTimeout(
|
447 | 449 | return; |
448 | 450 | } |
449 | 451 | try { |
450 | | -spawn("taskkill", ["/PID", String(child.pid), "/T", "/F"], { |
| 452 | +spawn(taskkillPath, ["/PID", String(child.pid), "/T", "/F"], { |
451 | 453 | stdio: "ignore", |
452 | 454 | windowsHide: true, |
453 | 455 | }); |
@@ -467,10 +469,14 @@ export async function runCommandWithTimeout(
|
467 | 469 | } |
468 | 470 | if (process.platform === "win32" && typeof child.pid === "number" && child.pid > 0) { |
469 | 471 | try { |
470 | | -spawn("taskkill", ["/PID", String(child.pid), "/T", "/F"], { |
471 | | -stdio: "ignore", |
472 | | -windowsHide: true, |
473 | | -}); |
| 472 | +spawn( |
| 473 | +getWindowsSystem32ExePath("taskkill.exe"), |
| 474 | +["/PID", String(child.pid), "/T", "/F"], |
| 475 | +{ |
| 476 | +stdio: "ignore", |
| 477 | +windowsHide: true, |
| 478 | +}, |
| 479 | +); |
474 | 480 | return; |
475 | 481 | } catch { |
476 | 482 | // Fall through to Node's direct child kill as a last resort. |
|