Skip to content

Commit 82db101

Browse files
committed
Fix CLI in remote when inheritEnv is false
Fixes microsoft/vscode-remote-release#823
1 parent ce414a8 commit 82db101

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/vs/workbench/api/node/extHostTerminalService.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,12 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
488488
};
489489
}
490490

491+
private async _getNonInheritedEnv(): Promise<platform.IProcessEnvironment> {
492+
const env = await getMainProcessParentEnv();
493+
env.VSCODE_IPC_HOOK_CLI = process.env['VSCODE_IPC_HOOK_CLI']!;
494+
return env;
495+
}
496+
491497
public async $createProcess(id: number, shellLaunchConfigDto: ShellLaunchConfigDto, activeWorkspaceRootUriComponents: UriComponents, cols: number, rows: number, isWorkspaceShellAllowed: boolean): Promise<void> {
492498
const shellLaunchConfig: IShellLaunchConfig = {
493499
name: shellLaunchConfigDto.name,
@@ -523,7 +529,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
523529
const envFromConfig = this._apiInspectConfigToPlain(configProvider.getConfiguration('terminal.integrated').inspect<ITerminalEnvironment>(`env.${platformKey}`));
524530
const workspaceFolders = await this._extHostWorkspace.getWorkspaceFolders2();
525531
const variableResolver = workspaceFolders ? new ExtHostVariableResolverService(workspaceFolders, this._extHostDocumentsAndEditors, configProvider) : undefined;
526-
const baseEnv = terminalConfig.get<boolean>('inheritEnv', true) ? process.env as platform.IProcessEnvironment : await getMainProcessParentEnv();
532+
const baseEnv = terminalConfig.get<boolean>('inheritEnv', true) ? process.env as platform.IProcessEnvironment : await this._getNonInheritedEnv();
527533
const env = terminalEnvironment.createTerminalEnvironment(
528534
shellLaunchConfig,
529535
lastActiveWorkspace,

0 commit comments

Comments
 (0)