fix(windows): resolve taskkill in core spawns

This commit is contained in:
Vincent Koc
2026-06-21 10:57:35 +02:00
parent 7975ec0b11
commit a192b2ea52
3 changed files with 23 additions and 11 deletions

View File

@@ -100,6 +100,7 @@ import {
type PreUpdateConfigRestoreInput,
} from "../../infra/update-post-core-context.js";
import { runGatewayUpdate, type UpdateRunResult } from "../../infra/update-runner.js";
import { getWindowsSystem32ExePath } from "../../infra/windows-install-roots.js";
import { normalizePluginsConfig, resolveEffectiveEnableState } from "../../plugins/config-state.js";
import {
loadInstalledPluginIndexInstallRecords,
@@ -2877,10 +2878,14 @@ async function readPostCorePluginUpdateResultFile(
function stopPostCoreUpdateChild(child: ChildProcess): void {
if (process.platform === "win32" && child.pid) {
try {
const killer = spawn("taskkill", ["/PID", String(child.pid), "/T", "/F"], {
stdio: "ignore",
windowsHide: true,
});
const killer = spawn(
getWindowsSystem32ExePath("taskkill.exe"),
["/PID", String(child.pid), "/T", "/F"],
{
stdio: "ignore",
windowsHide: true,
},
);
killer.once("error", () => {
child.kill();
});