Skip to content

Commit 762c6af

Browse files
Pick-catsteipete
authored andcommitted
fix(microsoft-foundry): hard-stop timed-out Azure CLI probes
1 parent 4048b57 commit 762c6af

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎extensions/microsoft-foundry/cli.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export function execAz(args: string[]): string {
5252
encoding: "utf-8",
5353
timeout: 30_000,
5454
shell: process.platform === "win32",
55+
killSignal: "SIGKILL",
5556
}),
5657
) ?? ""
5758
);

‎extensions/microsoft-foundry/index.test.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
44
import type { ProviderAuthMethod } from "openclaw/plugin-sdk/core";
55
import { createTestPluginApi } from "openclaw/plugin-sdk/plugin-test-api";
66
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
7-
import { azLoginDeviceCodeWithOptions, getAccessTokenResultAsync } from "./cli.js";
7+
import { azLoginDeviceCodeWithOptions, execAz, getAccessTokenResultAsync } from "./cli.js";
88
import plugin from "./index.js";
99
import {
1010
promptApiKeyEndpointAndModel,
@@ -378,6 +378,17 @@ describe("microsoft-foundry plugin", () => {
378378
);
379379
});
380380

381+
it("hard-stops a synchronous Azure CLI command at its timeout", () => {
382+
execFileSyncMock.mockReturnValue("ok");
383+
execAz(["version", "--output", "none"]);
384+
385+
expect(execFileSyncMock).toHaveBeenCalledWith(
386+
"az",
387+
["version", "--output", "none"],
388+
expect.objectContaining({ timeout: 30_000, killSignal: "SIGKILL" }),
389+
);
390+
});
391+
381392
it("fails clearly when the selected Azure subscription is not in the enabled list", async () => {
382393
const provider = registerProvider();
383394
execFileSyncMock.mockImplementation((_file: string, args: string[]) => {

0 commit comments

Comments
 (0)