Improve env variable handling around extension host connection type (#152466)

This commit is contained in:
Alexandru Dima
2022-06-17 15:20:53 +02:00
committed by GitHub
parent 0f05ed4758
commit 47652af0b6
5 changed files with 106 additions and 7 deletions

View File

@@ -22,6 +22,7 @@ import { logRemoteEntry } from 'vs/workbench/services/extensions/common/remoteCo
import { removeDangerousEnvVariables } from 'vs/base/common/processes';
import { IExtensionHostStatusService } from 'vs/server/node/extensionHostStatusService';
import { DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
import { IPCExtHostConnection, writeExtHostConnection, SocketExtHostConnection } from 'vs/workbench/services/extensions/common/extensionHostEnv';
export async function buildUserEnvironment(startParamsEnv: { [key: string]: string | null } = {}, withUserShellEnvironment: boolean, language: string, isDebug: boolean, environmentService: IServerEnvironmentService, logService: ILogService): Promise<IProcessEnvironment> {
const nlsConfig = await getNLSConfiguration(language, environmentService.userDataPath);
@@ -244,11 +245,11 @@ export class ExtensionHostConnection {
let extHostNamedPipeServer: net.Server | null;
if (this._canSendSocket) {
env['VSCODE_EXTHOST_WILL_SEND_SOCKET'] = 'true';
writeExtHostConnection(new SocketExtHostConnection(), env);
extHostNamedPipeServer = null;
} else {
const { namedPipeServer, pipeName } = await this._listenOnPipe();
env['VSCODE_IPC_HOOK_EXTHOST'] = pipeName;
writeExtHostConnection(new IPCExtHostConnection(pipeName), env);
extHostNamedPipeServer = namedPipeServer;
}