





















@@ -21,9 +21,14 @@ import {
2121redactHomePath,
2222redactJsonValueForDevToolLog,
2323} from "../../scripts/lib/dev-tooling-safety.ts";
24+import { resolveWindowsTaskkillPath } from "../../scripts/lib/windows-taskkill.mjs";
24252526const tempDirs: string[] = [];
262728+function expectedTaskkillPath(): string {
29+return resolveWindowsTaskkillPath();
30+}
31+2732async function waitForCondition(predicate: () => boolean, timeoutMs = 5_000): Promise<void> {
2833const started = Date.now();
2934while (Date.now() - started < timeoutMs) {
@@ -476,17 +481,22 @@ describe("script-specific dev tooling hardening", () => {
476481platform: "win32",
477482 runTaskkill,
478483});
479-expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "123", "/T"], {
484+expect(runTaskkill).toHaveBeenNthCalledWith(1, expectedTaskkillPath(), ["/PID", "123", "/T"], {
480485stdio: "ignore",
481486});
482487483488tuiPtyWatchTesting.signalChildProcessTree({ pid: 123, kill: childKill }, "SIGKILL", {
484489platform: "win32",
485490 runTaskkill,
486491});
487-expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "123", "/T", "/F"], {
488-stdio: "ignore",
489-});
492+expect(runTaskkill).toHaveBeenNthCalledWith(
493+2,
494+expectedTaskkillPath(),
495+["/PID", "123", "/T", "/F"],
496+{
497+stdio: "ignore",
498+},
499+);
490500expect(childKill).not.toHaveBeenCalled();
491501});
492502@@ -502,12 +512,17 @@ describe("script-specific dev tooling hardening", () => {
502512 runTaskkill,
503513});
504514505-expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "123", "/T"], {
506-stdio: "ignore",
507-});
508-expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "123", "/T", "/F"], {
515+expect(runTaskkill).toHaveBeenNthCalledWith(1, expectedTaskkillPath(), ["/PID", "123", "/T"], {
509516stdio: "ignore",
510517});
518+expect(runTaskkill).toHaveBeenNthCalledWith(
519+2,
520+expectedTaskkillPath(),
521+["/PID", "123", "/T", "/F"],
522+{
523+stdio: "ignore",
524+},
525+);
511526expect(childKill).not.toHaveBeenCalled();
512527});
513528此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。