




















@@ -5,7 +5,11 @@ import { readFile } from "node:fs/promises";
55import { tmpdir } from "node:os";
66import path, { win32 } from "node:path";
77import { afterEach, describe, expect, it, vi } from "vitest";
8-import { fetchJsonWithTimeout, runCommand } from "../../scripts/e2e/telegram-user-credential-io.ts";
8+import {
9+fetchJsonWithTimeout,
10+runCommand,
11+signalChildProcessTree,
12+} from "../../scripts/e2e/telegram-user-credential-io.ts";
913import {
1014expandHome,
1115resolvePrivateJsonDirectory,
@@ -403,6 +407,31 @@ setInterval(() => {}, 1000);
403407}
404408});
405409410+it("signals Windows credential helper process trees with taskkill", () => {
411+const child = {
412+kill: vi.fn(),
413+pid: 12345,
414+};
415+const runTaskkill = vi.fn(() => ({ error: undefined, status: 0 }));
416+417+signalChildProcessTree(child, "SIGTERM", {
418+platform: "win32",
419+ runTaskkill,
420+});
421+expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], {
422+stdio: "ignore",
423+});
424+425+signalChildProcessTree(child, "SIGKILL", {
426+platform: "win32",
427+ runTaskkill,
428+});
429+expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], {
430+stdio: "ignore",
431+});
432+expect(child.kill).not.toHaveBeenCalled();
433+});
434+406435it.runIf(process.platform !== "win32")(
407436"exits promptly after forwarded SIGTERM children exit cleanly",
408437async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。