From b96d65b9be475c9730384cd057974e47dd6b6595 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 22 Apr 2021 05:02:55 -0700 Subject: [PATCH] Finish adoption of IShellEnvironmentService in terminal Part of #108804 --- .../terminal/electron-browser/terminalInstanceService.ts | 6 ++++-- .../workbench/contrib/terminal/node/terminalEnvironment.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts b/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts index 1e0007a6fcae0..3c47b5eaf5e15 100644 --- a/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts +++ b/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts @@ -10,6 +10,7 @@ import type { Terminal as XTermTerminal } from 'xterm'; import type { SearchAddon as XTermSearchAddon } from 'xterm-addon-search'; import type { Unicode11Addon as XTermUnicode11Addon } from 'xterm-addon-unicode11'; import type { WebglAddon as XTermWebglAddon } from 'xterm-addon-webgl'; +import { IShellEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/shellEnvironmentService'; let Terminal: typeof XTermTerminal; let SearchAddon: typeof XTermSearchAddon; @@ -20,6 +21,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst public _serviceBrand: undefined; constructor( + @IShellEnvironmentService private readonly _shellEnvironmentService: IShellEnvironmentService ) { super(); } @@ -52,7 +54,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst return WebglAddon; } - public getMainProcessParentEnv(): Promise { - return getMainProcessParentEnv(); + public async getMainProcessParentEnv(): Promise { + return getMainProcessParentEnv(await this._shellEnvironmentService.getShellEnv()); } } diff --git a/src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts b/src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts index 2a3821ab7e9e9..988b9aed510ef 100644 --- a/src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts +++ b/src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts @@ -9,7 +9,7 @@ import { IProcessEnvironment, isLinux, isMacintosh, isWindows } from 'vs/base/co let mainProcessParentEnv: IProcessEnvironment | undefined; -export async function getMainProcessParentEnv(baseEnvironment: IProcessEnvironment = process.env as IProcessEnvironment): Promise { +export async function getMainProcessParentEnv(baseEnvironment: IProcessEnvironment): Promise { if (mainProcessParentEnv) { return mainProcessParentEnv; }