fix: treat Windows platform labels as Windows for node shell (#1760)
Thanks @ymat19. Co-authored-by: ymat19 <45934497+ymat19@users.noreply.github.com>
This commit is contained in:
@@ -31,6 +31,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- Matrix: decrypt E2EE media attachments with preflight size guard. (#1744) Thanks @araa47.
|
- Matrix: decrypt E2EE media attachments with preflight size guard. (#1744) Thanks @araa47.
|
||||||
- Gateway: allow Control UI token-only auth to skip device pairing even when device identity is present (`gateway.controlUi.allowInsecureAuth`). (#1679) Thanks @steipete.
|
- Gateway: allow Control UI token-only auth to skip device pairing even when device identity is present (`gateway.controlUi.allowInsecureAuth`). (#1679) Thanks @steipete.
|
||||||
- Gateway: include inline config env vars in service install environments. (#1735) Thanks @Seredeep.
|
- Gateway: include inline config env vars in service install environments. (#1735) Thanks @Seredeep.
|
||||||
|
- Exec: treat Windows platform labels as Windows for node shell selection. (#1760) Thanks @ymat19.
|
||||||
- BlueBubbles: route phone-number targets to DMs, avoid leaking routing IDs, and auto-create missing DMs (Private API required). (#1751) Thanks @tyler6204. https://docs.clawd.bot/channels/bluebubbles
|
- BlueBubbles: route phone-number targets to DMs, avoid leaking routing IDs, and auto-create missing DMs (Private API required). (#1751) Thanks @tyler6204. https://docs.clawd.bot/channels/bluebubbles
|
||||||
- BlueBubbles: keep part-index GUIDs in reply tags when short IDs are missing.
|
- BlueBubbles: keep part-index GUIDs in reply tags when short IDs are missing.
|
||||||
- Web UI: hide internal `message_id` hints in chat bubbles.
|
- Web UI: hide internal `message_id` hints in chat bubbles.
|
||||||
|
|||||||
40
src/infra/node-shell.test.ts
Normal file
40
src/infra/node-shell.test.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
import { buildNodeShellCommand } from "./node-shell.js";
|
||||||
|
|
||||||
|
describe("buildNodeShellCommand", () => {
|
||||||
|
it("uses cmd.exe for win32", () => {
|
||||||
|
expect(buildNodeShellCommand("echo hi", "win32")).toEqual([
|
||||||
|
"cmd.exe",
|
||||||
|
"/d",
|
||||||
|
"/s",
|
||||||
|
"/c",
|
||||||
|
"echo hi",
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses cmd.exe for windows labels", () => {
|
||||||
|
expect(buildNodeShellCommand("echo hi", "windows")).toEqual([
|
||||||
|
"cmd.exe",
|
||||||
|
"/d",
|
||||||
|
"/s",
|
||||||
|
"/c",
|
||||||
|
"echo hi",
|
||||||
|
]);
|
||||||
|
expect(buildNodeShellCommand("echo hi", "Windows 11")).toEqual([
|
||||||
|
"cmd.exe",
|
||||||
|
"/d",
|
||||||
|
"/s",
|
||||||
|
"/c",
|
||||||
|
"echo hi",
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses /bin/sh for darwin", () => {
|
||||||
|
expect(buildNodeShellCommand("echo hi", "darwin")).toEqual(["/bin/sh", "-lc", "echo hi"]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses /bin/sh when platform missing", () => {
|
||||||
|
expect(buildNodeShellCommand("echo hi")).toEqual(["/bin/sh", "-lc", "echo hi"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -2,7 +2,7 @@ export function buildNodeShellCommand(command: string, platform?: string | null)
|
|||||||
const normalized = String(platform ?? "")
|
const normalized = String(platform ?? "")
|
||||||
.trim()
|
.trim()
|
||||||
.toLowerCase();
|
.toLowerCase();
|
||||||
if (normalized === "win32") {
|
if (normalized.startsWith("win")) {
|
||||||
return ["cmd.exe", "/d", "/s", "/c", command];
|
return ["cmd.exe", "/d", "/s", "/c", command];
|
||||||
}
|
}
|
||||||
return ["/bin/sh", "-lc", command];
|
return ["/bin/sh", "-lc", command];
|
||||||
|
|||||||
Reference in New Issue
Block a user