mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 10:02:04 +00:00
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:
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"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user