Skip to content

Commit d0c66c3

Browse files
fix(server): a Muse binary path containing = keeps its native launch
GNU env reads such an operand as an assignment even after --. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 7cf426a commit d0c66c3

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

‎packages/provider-muse/src/server/sdk.test.ts‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
museVerbatimPath,
2222
museWorkspaceRoot,
2323
type MuseSdkHost,
24+
type MuseSdkHostOptions,
2425
} from "./sdk.ts";
2526

2627
vi.mock("node:fs/promises", { spy: true });
@@ -302,6 +303,22 @@ describe("Muse startup on Linux", () => {
302303
);
303304
});
304305

306+
describe("Muse startup with a command env cannot run", () => {
307+
it.effect("keeps the native launch for a binary path containing =", () =>
308+
Effect.gen(function* () {
309+
const launches: Array<MuseSdkHostOptions["launch"]> = [];
310+
yield* createMuseSdkHostEffect(
311+
{ binaryPath: "/opt/muse=stable/bin/muse", cwd: "/w" },
312+
(options) => {
313+
launches.push(options.launch);
314+
return Promise.resolve({ close: async () => {} } as unknown as MuseSdkHost);
315+
},
316+
).pipe(Effect.provideService(HostProcess.Platform, "linux"));
317+
expect(launches).toEqual([{ command: "/opt/muse=stable/bin/muse", args: [] }]);
318+
}),
319+
);
320+
});
321+
305322
describe("Muse launch", () => {
306323
const CMD = "C:\\Windows\\system32\\cmd.exe";
307324
const onWindows = (resolved: string | undefined, env: NodeJS.ProcessEnv = { ComSpec: CMD }) =>

‎packages/provider-muse/src/server/sdk.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,13 @@ export const createMuseSdkHostEffect = Effect.fn("createMuseSdkHostEffect")(func
215215
const native = options.launch ?? (yield* museLaunch(options.binaryPath, options.environment));
216216
// libuv blocks the server while the child runs chdir and the PATH search, which a hung
217217
// mount stalls. GNU env does both in the child and, unlike dash, keeps every environment
218-
// entry, including exported bash functions.
218+
// entry, including exported bash functions. It reads a command containing `=`, or a lone
219+
// `-`, as an assignment or option even after `--`, so those keep the native launch.
219220
const { cwd, ...childEntered } = options;
220221
const hostOptions: Omit<MuseSdkHostOptions, "signal"> =
221-
(yield* HostProcess.Platform) === "linux"
222+
(yield* HostProcess.Platform) === "linux" &&
223+
native.command !== "-" &&
224+
!native.command.includes("=")
222225
? {
223226
...childEntered,
224227
launch: {

0 commit comments

Comments
 (0)