@@ -125,6 +125,10 @@ function mockSpawnerLayer(
125125 handler : (
126126 command : string ,
127127 args : ReadonlyArray < string > ,
128+ options : {
129+ readonly env ?: NodeJS . ProcessEnv ;
130+ readonly shell ?: boolean ;
131+ } ,
128132 ) => {
129133 readonly stdout ?: string ;
130134 readonly stderr ?: string ;
@@ -138,8 +142,14 @@ function mockSpawnerLayer(
138142 const childProcess = command as unknown as {
139143 readonly command : string ;
140144 readonly args : ReadonlyArray < string > ;
145+ readonly options ?: {
146+ readonly env ?: NodeJS . ProcessEnv ;
147+ readonly shell ?: boolean ;
148+ } ;
141149 } ;
142- return Effect . succeed ( mockHandle ( handler ( childProcess . command , childProcess . args ) ) ) ;
150+ return Effect . succeed (
151+ mockHandle ( handler ( childProcess . command , childProcess . args , childProcess . options ?? { } ) ) ,
152+ ) ;
143153 } ) ,
144154 ) ;
145155}
@@ -240,7 +250,16 @@ describe("providerMaintenanceRunner", () => {
240250 } ) ;
241251
242252 it . effect ( "uses the resolved provider capabilities when choosing the update executable" , ( ) => {
243- const calls : Array < { command : string ; args : ReadonlyArray < string > } > = [ ] ;
253+ const updateEnv = {
254+ PATH : "C:\\Provider\\Bin" ,
255+ FOO : "bar" ,
256+ } ;
257+ const calls : Array < {
258+ command : string ;
259+ args : ReadonlyArray < string > ;
260+ env ?: NodeJS . ProcessEnv ;
261+ shell ?: boolean ;
262+ } > = [ ] ;
244263 return Effect . gen ( function * ( ) {
245264 const { registry } = yield * makeRegistry ( {
246265 ...baseProvider ,
@@ -257,30 +276,39 @@ describe("providerMaintenanceRunner", () => {
257276 const updater = yield * makeTestRunner ( {
258277 ...registry ,
259278 getProviderMaintenanceCapabilitiesForInstance : ( ) =>
260- Effect . succeed (
261- makeProviderMaintenanceCapabilities ( {
262- provider : CODEX_DRIVER ,
263- packageName : "@openai/codex" ,
264- updateExecutable : "bun" ,
265- updateArgs : [ "i" , "-g" , "@openai/codex@latest" ] ,
266- updateLockKey : "bun-global" ,
267- } ) ,
268- ) ,
279+ Effect . succeed ( {
280+ provider : CODEX_DRIVER ,
281+ packageName : "@openai/codex" ,
282+ update : {
283+ command : "bun i -g @openai/codex@latest" ,
284+ executable : "bun" ,
285+ args : [ "i" , "-g" , "@openai/codex@latest" ] ,
286+ lockKey : "bun-global" ,
287+ env : updateEnv ,
288+ } ,
289+ } ) ,
269290 } ) ;
270291
271292 yield * updater . updateProvider ( CODEX_DRIVER ) ;
272293 assert . deepStrictEqual ( calls , [
273294 {
274295 command : "bun" ,
275296 args : [ "i" , "-g" , "@openai/codex@latest" ] ,
297+ env : updateEnv ,
298+ ...( process . platform === "win32" ? { shell : true } : { } ) ,
276299 } ,
277300 ] ) ;
278301 } ) . pipe (
279302 Effect . provide (
280303 Layer . mergeAll (
281304 latestVersionHttpClient ( "0.0.0" ) ,
282- mockSpawnerLayer ( ( command , args ) => {
283- calls . push ( { command, args } ) ;
305+ mockSpawnerLayer ( ( command , args , options ) => {
306+ calls . push ( {
307+ command,
308+ args,
309+ ...( options . env ? { env : options . env } : { } ) ,
310+ ...( options . shell !== undefined ? { shell : options . shell } : { } ) ,
311+ } ) ;
284312 return { stdout : "updated" } ;
285313 } ) ,
286314 ) ,
0 commit comments