From 2af13d9fc6f9a5c0f25ffd5c056bdec16fc929ee Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Fri, 10 Apr 2020 08:02:02 -0700 Subject: [PATCH] Move to userHomeSync in terminal Part of #94506 --- .../contrib/terminal/browser/terminalProcessManager.ts | 7 +++++-- .../contrib/terminal/common/terminalEnvironment.ts | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts index 285f8c9b047..ce58882c53d 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.ts @@ -135,6 +135,9 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce const hasRemoteAuthority = !!this.remoteAuthority; let launchRemotely = hasRemoteAuthority || forceExtHostProcess; + // userHomeSync is needed here as remote resolvers can launch local terminals before + // they're connected to the remote. + this.userHome = this._remotePathService.userHomeSync?.fsPath; const userHomeUri = await this._remotePathService.userHome; this.os = platform.OS; if (launchRemotely) { @@ -142,6 +145,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce if (hasRemoteAuthority) { const remoteEnv = await this._remoteAgentService.getEnvironment(); if (remoteEnv) { + this.userHome = remoteEnv.userHome.path; this.os = remoteEnv.os; } } @@ -149,7 +153,6 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(); this._process = this._instantiationService.createInstance(TerminalProcessExtHostProxy, this._terminalId, shellLaunchConfig, activeWorkspaceRootUri, cols, rows, this._configHelper); } else { - this.userHome = userHomeUri.fsPath; this._process = await this._launchProcess(shellLaunchConfig, cols, rows, this.userHome, isScreenReaderModeEnabled); } } @@ -195,7 +198,7 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce shellLaunchConfig: IShellLaunchConfig, cols: number, rows: number, - userHome: string, + userHome: string | undefined, isScreenReaderModeEnabled: boolean ): Promise { const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(Schemas.file); diff --git a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts index 74424a6aa6a..20c3551c8f7 100644 --- a/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts +++ b/src/vs/workbench/contrib/terminal/common/terminalEnvironment.ts @@ -176,7 +176,7 @@ export function getLangEnvVariable(locale?: string): string { export function getCwd( shell: IShellLaunchConfig, - userHome: string, + userHome: string | undefined, lastActiveWorkspace: IWorkspaceFolder | undefined, configurationResolverService: IConfigurationResolverService | undefined, root: Uri | undefined, @@ -206,7 +206,7 @@ export function getCwd( // If there was no custom cwd or it was relative with no workspace if (!cwd) { - cwd = root ? root.fsPath : userHome; + cwd = root ? root.fsPath : userHome || ''; } return _sanitizeCwd(cwd); -- GitLab