Skip to content

Commit 9a8d29e

Browse files
test
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
1 parent e950578 commit 9a8d29e

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

build/scripts/entrypoint-volume.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,8 @@ echo "[INFO] Node.js dir for running VS Code: $VSCODE_NODEJS_RUNTIME_DIR"
134134
# Test-only repro switch for shellEnv code path (remove after validation).
135135
export CHECODE_TEST_STRIP_LD_LIBRARY_PATH_BEFORE_SPAWN=1
136136

137+
# Temporary debug switch for shell environment resolution logs in Output view.
138+
export CHECODE_DEBUG_SHELL_ENV=1
139+
137140
# Run launcher
138141
"$VSCODE_NODEJS_RUNTIME_DIR/node" ./launcher/entrypoint.js

code/src/vs/platform/shell/node/shellEnv.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export async function getResolvedShellEnv(configurationService: IConfigurationSe
100100
}
101101

102102
async 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

Comments
 (0)