diff --git a/package.json b/package.json index 145df3d7839..788cc9872d7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-oss-dev", "version": "1.55.0", - "distro": "0357427beb5cd348177cd1ed381cd740082966c4", + "distro": "01f21bd70c49582992ba219c57b78d1c94bb5da7", "author": { "name": "Microsoft Corporation" }, diff --git a/src/vs/base/node/shell.ts b/src/vs/base/node/shell.ts index cacc2da4db2..98861c0dd07 100644 --- a/src/vs/base/node/shell.ts +++ b/src/vs/base/node/shell.ts @@ -13,7 +13,7 @@ import * as processes from 'vs/base/node/processes'; * shell that the terminal uses by default. * @param p The platform to detect the shell of. */ -export async function getSystemShell(p: platform.Platform, env = process.env as platform.IProcessEnvironment): Promise { +export async function getSystemShell(p: platform.Platform, env: platform.IProcessEnvironment): Promise { if (p === platform.Platform.Windows) { if (platform.isWindows) { return getSystemShellWindows(); @@ -25,7 +25,7 @@ export async function getSystemShell(p: platform.Platform, env = process.env as return getSystemShellUnixLike(p, env); } -export function getSystemShellSync(p: platform.Platform, env = process.env as platform.IProcessEnvironment): string { +export function getSystemShellSync(p: platform.Platform, env: platform.IProcessEnvironment): string { if (p === platform.Platform.Windows) { if (platform.isWindows) { return getSystemShellWindowsSync(env); diff --git a/src/vs/platform/environment/node/shellEnv.ts b/src/vs/platform/environment/node/shellEnv.ts index 9454f1d4730..c2d7594b124 100644 --- a/src/vs/platform/environment/node/shellEnv.ts +++ b/src/vs/platform/environment/node/shellEnv.ts @@ -79,7 +79,7 @@ async function doResolveUnixShellEnv(logService: ILogService): Promise this._defaultShell = s); + getSystemShell(platform.platform, process.env as platform.IProcessEnvironment).then(s => this._defaultShell = s); this._updateLastActiveWorkspace(); this._updateVariableResolver(); @@ -83,7 +83,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService { return terminalEnvironment.getDefaultShell( fetchSetting, this._isWorkspaceShellAllowed, - this._defaultShell ?? getSystemShellSync(platform.platform), + this._defaultShell ?? getSystemShellSync(platform.platform, process.env as platform.IProcessEnvironment), process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'), process.env.windir, terminalEnvironment.createVariableResolver(this._lastActiveWorkspace, this._variableResolver), diff --git a/src/vs/workbench/contrib/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/contrib/terminal/electron-browser/terminal.contribution.ts index 0c11faaf0b3..6b8955477c1 100644 --- a/src/vs/workbench/contrib/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/contrib/terminal/electron-browser/terminal.contribution.ts @@ -13,6 +13,8 @@ import { IConfigurationRegistry, Extensions } from 'vs/platform/configuration/co import { getTerminalShellConfiguration } from 'vs/workbench/contrib/terminal/common/terminalConfiguration'; import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { getSystemShell } from 'vs/base/node/shell'; +import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals'; +import { Platform } from 'vs/base/common/platform'; // This file contains additional desktop-only contributions on top of those in browser/ @@ -25,4 +27,5 @@ workbenchRegistry.registerWorkbenchContribution(TerminalNativeContribution, Life // Register configurations const configurationRegistry = Registry.as(Extensions.Configuration); -getTerminalShellConfiguration(getSystemShell).then(config => configurationRegistry.registerConfiguration(config)); +const systemShell = async (p: Platform) => getSystemShell(p, await process.getShellEnv()); +getTerminalShellConfiguration(systemShell).then(config => configurationRegistry.registerConfiguration(config)); diff --git a/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts b/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts index 32673f92f70..facc10fc01b 100644 --- a/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts +++ b/src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts @@ -13,6 +13,7 @@ import { IStorageService, StorageScope } from 'vs/platform/storage/common/storag import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { getMainProcessParentEnv } from 'vs/workbench/contrib/terminal/node/terminalEnvironment'; import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver'; +import { IShellEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/shellEnvironmentService'; import { IHistoryService } from 'vs/workbench/services/history/common/history'; import type { Terminal as XTermTerminal } from 'xterm'; import type { SearchAddon as XTermSearchAddon } from 'xterm-addon-search'; @@ -34,7 +35,8 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst @IConfigurationResolverService private readonly _configurationResolverService: IConfigurationResolverService, @IWorkspaceContextService private readonly _workspaceContextService: IWorkspaceContextService, @IHistoryService private readonly _historyService: IHistoryService, - @ILogService private readonly _logService: ILogService + @ILogService private readonly _logService: ILogService, + @IShellEnvironmentService private readonly _shellEnvironmentService: IShellEnvironmentService ) { super(); } @@ -76,10 +78,11 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(); let lastActiveWorkspace = activeWorkspaceRootUri ? this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) : undefined; lastActiveWorkspace = lastActiveWorkspace === null ? undefined : lastActiveWorkspace; + const shell = getDefaultShell( (key) => this._configurationService.inspect(key), isWorkspaceShellAllowed, - await getSystemShell(platformOverride), + await getSystemShell(platformOverride, await this._shellEnvironmentService.getShellEnv()), process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'), process.env.windir, createVariableResolver(lastActiveWorkspace, this._configurationResolverService), @@ -87,6 +90,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst useAutomationShell, platformOverride ); + const args = getDefaultShellArgs( (key) => this._configurationService.inspect(key), isWorkspaceShellAllowed, @@ -95,6 +99,7 @@ export class TerminalInstanceService extends Disposable implements ITerminalInst this._logService, platformOverride ); + return Promise.resolve({ shell, args }); }