Skip to content

Commit

Permalink
Finish adoption of IShellEnvironmentService in terminal
Browse files Browse the repository at this point in the history
Part of #108804
  • Loading branch information
Tyriar committed Apr 22, 2021
1 parent 5c90493 commit b96d65b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,6 +21,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst
public _serviceBrand: undefined;

constructor(
@IShellEnvironmentService private readonly _shellEnvironmentService: IShellEnvironmentService
) {
super();
}
Expand Down Expand Up @@ -52,7 +54,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst
return WebglAddon;
}

public getMainProcessParentEnv(): Promise<IProcessEnvironment> {
return getMainProcessParentEnv();
public async getMainProcessParentEnv(): Promise<IProcessEnvironment> {
return getMainProcessParentEnv(await this._shellEnvironmentService.getShellEnv());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<IProcessEnvironment> {
export async function getMainProcessParentEnv(baseEnvironment: IProcessEnvironment): Promise<IProcessEnvironment> {
if (mainProcessParentEnv) {
return mainProcessParentEnv;
}
Expand Down

0 comments on commit b96d65b

Please sign in to comment.