@@ -100,6 +100,7 @@ export async function getResolvedShellEnv(configurationService: IConfigurationSe
100100}
101101
102102async function doResolveUnixShellEnv ( logService : ILogService , token : CancellationToken ) : Promise < typeof process . env > {
103+ const shouldDebugShellEnv = process . env [ 'CHECODE_DEBUG_SHELL_ENV' ] === '1' || process . env [ 'CHECODE_DEBUG_SHELL_ENV' ] === 'true' ;
103104 const runAsNode = process . env [ 'ELECTRON_RUN_AS_NODE' ] ;
104105 logService . trace ( 'getUnixShellEnvironment#runAsNode' , runAsNode ) ;
105106
@@ -156,6 +157,16 @@ async function doResolveUnixShellEnv(logService: ILogService, token: Cancellatio
156157 }
157158
158159 logService . trace ( 'getUnixShellEnvironment#spawn' , JSON . stringify ( shellArgs ) , command ) ;
160+ if ( shouldDebugShellEnv ) {
161+ logService . info ( 'getUnixShellEnvironment#spawnDebug' , {
162+ shell : systemShellUnix ,
163+ shellArgs,
164+ command,
165+ LD_LIBRARY_PATH : env [ 'LD_LIBRARY_PATH' ] ,
166+ SHELL : env [ 'SHELL' ] ,
167+ HOME : env [ 'HOME' ]
168+ } ) ;
169+ }
159170
160171 const child = spawn ( systemShellUnix , [ ...shellArgs , command ] , {
161172 detached : true ,
@@ -187,9 +198,25 @@ async function doResolveUnixShellEnv(logService: ILogService, token: Cancellatio
187198 const stderrStr = Buffer . concat ( stderr ) . toString ( 'utf8' ) ;
188199 if ( stderrStr . trim ( ) ) {
189200 logService . trace ( 'getUnixShellEnvironment#stderr' , stderrStr ) ;
201+ if ( shouldDebugShellEnv ) {
202+ logService . error ( 'getUnixShellEnvironment#stderrDebug' , stderrStr ) ;
203+ }
190204 }
191205
192206 if ( code || signal ) {
207+ if ( shouldDebugShellEnv ) {
208+ logService . error ( 'getUnixShellEnvironment#spawnFailureDebug' , {
209+ code,
210+ signal,
211+ shell : systemShellUnix ,
212+ shellArgs,
213+ command,
214+ LD_LIBRARY_PATH : env [ 'LD_LIBRARY_PATH' ] ,
215+ SHELL : env [ 'SHELL' ] ,
216+ HOME : env [ 'HOME' ] ,
217+ stderr : stderrStr
218+ } ) ;
219+ }
193220 return reject ( new Error ( localize ( 'resolveShellEnvExitError' , "Unexpected exit code from spawned shell (code {0}, signal {1})" , code , signal ) ) ) ;
194221 }
195222
0 commit comments