Skip to content

Commit

Permalink
[server] ignore stderr while resolving shell env
Browse files Browse the repository at this point in the history
  • Loading branch information
akosyakov committed Jun 18, 2021
1 parent e572eb3 commit bd7b462
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/vs/platform/environment/node/shellEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ async function doResolveUnixShellEnv(logService: ILogService): Promise<typeof pr

const child = spawn(systemShellUnix, [...shellArgs, command], {
detached: true,
stdio: ['ignore', 'pipe', 'pipe'],
// see https://github.com/gitpod-io/gitpod/issues/4460#issuecomment-863799213
stdio: ['ignore', 'pipe', 'ignore'],
env
});

Expand All @@ -107,20 +108,17 @@ async function doResolveUnixShellEnv(logService: ILogService): Promise<typeof pr
});

const buffers: Buffer[] = [];
child.stdout.on('data', b => buffers.push(b));

const stderr: Buffer[] = [];
child.stderr.on('data', b => stderr.push(b));
child.stdout.on('data', b => {
logService.trace('getUnixShellEnvironment#stdoutData', b.toString('utf8'));
buffers.push(b);
});

child.on('close', (code, signal) => {
logService.trace('getUnixShellEnvironment#close', code, signal);

const raw = Buffer.concat(buffers).toString('utf8');
logService.trace('getUnixShellEnvironment#raw', raw);

const stderrStr = Buffer.concat(stderr).toString('utf8');
if (stderrStr.trim()) {
logService.trace('getUnixShellEnvironment#stderr', stderrStr);
}

if (code || signal) {
return reject(new Error(`Failed to get environment (code ${code}, signal ${signal})`));
}
Expand Down

0 comments on commit bd7b462

Please sign in to comment.