Make parts of terminal process launching async

This commit is contained in:
Daniel Imms
2019-06-12 16:37:56 -07:00
parent e3609a9576
commit 941b5ac526
2 changed files with 6 additions and 6 deletions
@@ -96,11 +96,11 @@ export class TerminalProcessManager implements ITerminalProcessManager {
}
}
public createProcess(
public async createProcess(
shellLaunchConfig: IShellLaunchConfig,
cols: number,
rows: number
): void {
): Promise<void> {
const forceExtHostProcess = (this._configHelper.config as any).extHostProcess;
if (shellLaunchConfig.cwd && typeof shellLaunchConfig.cwd === 'object') {
this.remoteAuthority = getRemoteAuthority(shellLaunchConfig.cwd);
@@ -126,7 +126,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot();
this._process = this._instantiationService.createInstance(TerminalProcessExtHostProxy, this._terminalId, shellLaunchConfig, activeWorkspaceRootUri, cols, rows, this._configHelper);
} else {
this._process = this._launchProcess(shellLaunchConfig, cols, rows);
this._process = await this._launchProcess(shellLaunchConfig, cols, rows);
}
this.processState = ProcessState.LAUNCHING;
@@ -159,7 +159,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
}, LAUNCHING_DURATION);
}
private _launchProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): ITerminalChildProcess {
private async _launchProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): Promise<ITerminalChildProcess> {
if (!shellLaunchConfig.executable) {
this._configHelper.mergeDefaultShellPathAndArgs(shellLaunchConfig, this._terminalInstanceService.getDefaultShell(platform.platform));
}
@@ -171,7 +171,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
const lastActiveWorkspace = activeWorkspaceRootUri ? this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) : null;
const envFromConfigValue = this._workspaceConfigurationService.inspect<ITerminalEnvironment | undefined>(`terminal.integrated.env.${platformKey}`);
const isWorkspaceShellAllowed = this._configHelper.checkWorkspaceShellPermissions();
const baseEnv = this._configHelper.config.inheritEnv ? process.env as platform.IProcessEnvironment : this._terminalInstanceService.getMainProcessParentEnv();
const baseEnv = this._configHelper.config.inheritEnv ? process.env as platform.IProcessEnvironment : await this._terminalInstanceService.getMainProcessParentEnv();
const env = terminalEnvironment.createTerminalEnvironment(shellLaunchConfig, lastActiveWorkspace, envFromConfigValue, this._configurationResolverService, isWorkspaceShellAllowed, this._productService.version, this._configHelper.config.setLocaleVariables, baseEnv);
const useConpty = this._configHelper.config.windowsEnableConpty;
@@ -690,7 +690,7 @@ export interface ITerminalProcessManager extends IDisposable {
readonly onProcessExit: Event<number>;
dispose(immediate?: boolean): void;
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): void;
createProcess(shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number): Promise<void>;
write(data: string): void;
setDimensions(cols: number, rows: number): void;