mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 10:08:49 +01:00
Adopt requireTrust in terminal
This commit is contained in:
@@ -27,8 +27,6 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
|
||||
private _variableResolverPromise: Promise<ExtHostVariableResolverService>;
|
||||
private _lastActiveWorkspace: IWorkspaceFolder | undefined;
|
||||
|
||||
// TODO: Pull this from main side
|
||||
private _isWorkspaceShellAllowed: boolean = false;
|
||||
private _defaultShell: string | undefined;
|
||||
|
||||
constructor(
|
||||
@@ -77,16 +75,14 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
|
||||
}
|
||||
|
||||
public getDefaultShell(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string {
|
||||
const fetchSetting = (key: string): { userValue: string | string[] | undefined, value: string | string[] | undefined, defaultValue: string | string[] | undefined } => {
|
||||
const setting = configProvider
|
||||
const fetchSetting = (key: string): string | undefined => {
|
||||
return configProvider
|
||||
.getConfiguration(key.substr(0, key.lastIndexOf('.')))
|
||||
.inspect<string | string[]>(key.substr(key.lastIndexOf('.') + 1));
|
||||
return this._apiInspectConfigToPlain<string | string[]>(setting);
|
||||
.get<string>(key.substr(key.lastIndexOf('.') + 1));
|
||||
};
|
||||
|
||||
return terminalEnvironment.getDefaultShell(
|
||||
fetchSetting,
|
||||
this._isWorkspaceShellAllowed,
|
||||
this._defaultShell ?? getSystemShellSync(platform.platform, process.env as platform.IProcessEnvironment),
|
||||
process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432'),
|
||||
process.env.windir,
|
||||
@@ -97,24 +93,13 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
|
||||
}
|
||||
|
||||
public getDefaultShellArgs(useAutomationShell: boolean, configProvider: ExtHostConfigProvider): string[] | string {
|
||||
const fetchSetting = (key: string): { userValue: string | string[] | undefined, value: string | string[] | undefined, defaultValue: string | string[] | undefined } => {
|
||||
const setting = configProvider
|
||||
const fetchSetting = (key: string): string | string[] | undefined => {
|
||||
return configProvider
|
||||
.getConfiguration(key.substr(0, key.lastIndexOf('.')))
|
||||
.inspect<string | string[]>(key.substr(key.lastIndexOf('.') + 1));
|
||||
return this._apiInspectConfigToPlain<string | string[]>(setting);
|
||||
.get<string | string[]>(key.substr(key.lastIndexOf('.') + 1));
|
||||
};
|
||||
|
||||
return terminalEnvironment.getDefaultShellArgs(fetchSetting, this._isWorkspaceShellAllowed, useAutomationShell, terminalEnvironment.createVariableResolver(this._lastActiveWorkspace, this._variableResolver), this._logService);
|
||||
}
|
||||
|
||||
private _apiInspectConfigToPlain<T>(
|
||||
config: { key: string; defaultValue?: T; globalValue?: T; workspaceValue?: T, workspaceFolderValue?: T } | undefined
|
||||
): { userValue: T | undefined, value: T | undefined, defaultValue: T | undefined } {
|
||||
return {
|
||||
userValue: config ? config.globalValue : undefined,
|
||||
value: config ? config.workspaceValue : undefined,
|
||||
defaultValue: config ? config.defaultValue : undefined,
|
||||
};
|
||||
return terminalEnvironment.getDefaultShellArgs(fetchSetting, useAutomationShell, terminalEnvironment.createVariableResolver(this._lastActiveWorkspace, this._variableResolver), this._logService);
|
||||
}
|
||||
|
||||
private _registerListeners(): void {
|
||||
@@ -150,8 +135,4 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
|
||||
args: this.getDefaultShellArgs(useAutomationShell, configProvider)
|
||||
};
|
||||
}
|
||||
|
||||
public $acceptWorkspacePermissionsChanged(isAllowed: boolean): void {
|
||||
this._isWorkspaceShellAllowed = isAllowed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user