@@ -567,6 +567,21 @@ function resolveNpmPowerShellShim(ps1Path) {
567567 }
568568}
569569
570+ function resolveCmdExe ( ) {
571+ if ( process . env . ComSpec ) return process . env . ComSpec ;
572+ if ( process . env . SystemRoot ) return path . join ( process . env . SystemRoot , 'System32' , 'cmd.exe' ) ;
573+ return 'cmd.exe' ;
574+ }
575+
576+ function resolveWindowsBatchShim ( batchPath ) {
577+ return {
578+ command : resolveCmdExe ( ) ,
579+ argsPrefix : [ '/d' , '/s' , '/c' , batchPath ] ,
580+ shell : false ,
581+ display : batchPath
582+ } ;
583+ }
584+
570585function resolveCliLaunch ( execPath ) {
571586 const raw = String ( execPath || '' ) . trim ( ) ;
572587 if ( ! raw ) throw new Error ( 'CLI executable path is empty.' ) ;
@@ -578,7 +593,7 @@ function resolveCliLaunch(execPath) {
578593 const ext = path . extname ( selected ) . toLowerCase ( ) ;
579594
580595 if ( ext === '.cmd' || ext === '.bat' ) {
581- return { command : selected , argsPrefix : [ ] , shell : true , display : selected } ;
596+ return resolveWindowsBatchShim ( selected ) ;
582597 }
583598
584599 if ( ext === '.ps1' ) {
@@ -599,7 +614,7 @@ function resolveCliLaunch(execPath) {
599614 return {
600615 command : selected ,
601616 argsPrefix : [ ] ,
602- shell : ! path . extname ( selected ) ,
617+ shell : false ,
603618 display : selected
604619 } ;
605620}
@@ -1854,12 +1869,12 @@ function createCodexAppServerRun({ prompt, onStream, onStatus, workDir, requestI
18541869
18551870 console . log ( ` Running with codex app-server (profile: ${ codexProfile . key } , effort: ${ codexProfile . effort } ${ codexProfile . model ? `, model: ${ codexProfile . model } ` : '' } , bypass: ${ dangerousBypass ? 'on' : 'off' } )` ) ;
18561871 console . log ( ` Executable: ${ launchDisplay } ` ) ;
1857- console . log ( ` CWD: ${ workDir } ` ) ;
1872+ console . log ( ' CWD: ' + workDir ) ;
18581873
18591874 const child = spawn ( launch . command , appArgs , {
18601875 cwd : workDir ,
18611876 env : safeEnv ( workDir ) ,
1862- shell : launch . shell ,
1877+ shell : false ,
18631878 stdio : [ 'pipe' , 'pipe' , 'pipe' ] ,
18641879 windowsHide : true
18651880 } ) ;
@@ -2306,11 +2321,11 @@ function runTextCli(runtime, prompt, onStream, cwd, requestId, profile, options
23062321
23072322 console . log ( ` Running with ${ normalizedRuntime } CLI (profile: ${ cliProfile . key } ${ cliProfile . model ? `, model: ${ cliProfile . model } ` : ', default model' } )` ) ;
23082323 console . log ( ` Executable: ${ launch . display } ` ) ;
2309- console . log ( ` CWD: ${ workDir } ` ) ;
2324+ console . log ( ' CWD: ' + workDir ) ;
23102325 const proc = spawn ( launch . command , launchArgs , {
23112326 cwd : workDir ,
23122327 env : safeEnv ( workDir ) ,
2313- shell : launch . shell ,
2328+ shell : false ,
23142329 stdio : [ 'ignore' , 'pipe' , 'pipe' ] ,
23152330 windowsHide : true
23162331 } ) ;
@@ -2393,11 +2408,11 @@ function runCodexExec(prompt, onStream, cwd, requestId, profile, options = {}) {
23932408
23942409 console . log ( ` Running with codex exec (profile: ${ codexProfile . key } , effort: ${ codexProfile . effort } ${ codexProfile . model ? `, model: ${ codexProfile . model } ` : '' } , bypass: ${ dangerousBypass ? 'on' : 'off' } )` ) ;
23952410 console . log ( ` Executable: ${ launch . display } ` ) ;
2396- console . log ( ` CWD: ${ workDir } ` ) ;
2411+ console . log ( ' CWD: ' + workDir ) ;
23972412 const proc = spawn ( launch . command , launchArgs , {
23982413 cwd : workDir ,
23992414 env : safeEnv ( workDir ) ,
2400- shell : launch . shell ,
2415+ shell : false ,
24012416 stdio : [ 'ignore' , 'pipe' , 'pipe' ] ,
24022417 windowsHide : true
24032418 } ) ;
0 commit comments