File tree Expand file tree Collapse file tree
packages/provider-muse/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {
2121 museVerbatimPath ,
2222 museWorkspaceRoot ,
2323 type MuseSdkHost ,
24+ type MuseSdkHostOptions ,
2425} from "./sdk.ts" ;
2526
2627vi . 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+
305322describe ( "Muse launch" , ( ) => {
306323 const CMD = "C:\\Windows\\system32\\cmd.exe" ;
307324 const onWindows = ( resolved : string | undefined , env : NodeJS . ProcessEnv = { ComSpec : CMD } ) =>
Original file line number Diff line number Diff 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 : {
You can’t perform that action at this time.
0 commit comments