Merge pull request #159670 from microsoft/tyriar/157611_2

Fix terminal opening when multiple users are connected via remote-ssh
This commit is contained in:
Daniel Imms 2022-08-31 13:21:46 -07:00 committed by GitHub
commit 47e556e91b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -184,7 +184,7 @@ export function getShellIntegrationInjection(
newArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array
newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);
// Move .zshrc into $ZDOTDIR as the way to activate the script
const zdotdir = path.join(os.tmpdir(), 'vscode-zsh');
const zdotdir = path.join(os.tmpdir(), `${os.userInfo().username}-vscode-zsh`);
envMixin['ZDOTDIR'] = zdotdir;
const filesToCopy: IShellIntegrationConfigInjection['filesToCopy'] = [];
filesToCopy.push({

View file

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { deepStrictEqual, ok, strictEqual } from 'assert';
import { userInfo } from 'os';
import { NullLogService } from 'vs/platform/log/common/log';
import { ITerminalProcessOptions } from 'vs/platform/terminal/common/terminal';
import { getShellIntegrationInjection, IShellIntegrationConfigInjection } from 'vs/platform/terminal/node/terminalEnvironment';
@ -94,8 +95,14 @@ suite('platform - terminalEnvironment', () => {
if (process.platform !== 'win32') {
suite('zsh', () => {
suite('should override args', () => {
const expectedDir = /.+\/vscode-zsh/;
const expectedDests = [/.+\/vscode-zsh\/.zshrc/, /.+\/vscode-zsh\/.zprofile/, /.+\/vscode-zsh\/.zshenv/, /.+\/vscode-zsh\/.zlogin/];
const username = userInfo().username;
const expectedDir = new RegExp(`.+\/${username}-vscode-zsh`);
const expectedDests = [
new RegExp(`.+\/${username}-vscode-zsh\/\.zshrc`),
new RegExp(`.+\/${username}-vscode-zsh\/\.zprofile`),
new RegExp(`.+\/${username}-vscode-zsh\/\.zshenv`),
new RegExp(`.+\/${username}-vscode-zsh\/\.zlogin`)
];
const expectedSources = [
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-rc.zsh/,
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-profile.zsh/,