Skip to content

Commit 47e556e

Browse files
authored
Merge pull request microsoft#159670 from microsoft/tyriar/157611_2
Fix terminal opening when multiple users are connected via remote-ssh
2 parents edcf6e2 + 50ad05a commit 47e556e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/vs/platform/terminal/node/terminalEnvironment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export function getShellIntegrationInjection(
184184
newArgs = [...newArgs]; // Shallow clone the array to avoid setting the default array
185185
newArgs[newArgs.length - 1] = format(newArgs[newArgs.length - 1], appRoot);
186186
// Move .zshrc into $ZDOTDIR as the way to activate the script
187-
const zdotdir = path.join(os.tmpdir(), 'vscode-zsh');
187+
const zdotdir = path.join(os.tmpdir(), `${os.userInfo().username}-vscode-zsh`);
188188
envMixin['ZDOTDIR'] = zdotdir;
189189
const filesToCopy: IShellIntegrationConfigInjection['filesToCopy'] = [];
190190
filesToCopy.push({

src/vs/platform/terminal/test/node/terminalEnvironment.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { deepStrictEqual, ok, strictEqual } from 'assert';
7+
import { userInfo } from 'os';
78
import { NullLogService } from 'vs/platform/log/common/log';
89
import { ITerminalProcessOptions } from 'vs/platform/terminal/common/terminal';
910
import { getShellIntegrationInjection, IShellIntegrationConfigInjection } from 'vs/platform/terminal/node/terminalEnvironment';
@@ -94,8 +95,14 @@ suite('platform - terminalEnvironment', () => {
9495
if (process.platform !== 'win32') {
9596
suite('zsh', () => {
9697
suite('should override args', () => {
97-
const expectedDir = /.+\/vscode-zsh/;
98-
const expectedDests = [/.+\/vscode-zsh\/.zshrc/, /.+\/vscode-zsh\/.zprofile/, /.+\/vscode-zsh\/.zshenv/, /.+\/vscode-zsh\/.zlogin/];
98+
const username = userInfo().username;
99+
const expectedDir = new RegExp(`.+\/${username}-vscode-zsh`);
100+
const expectedDests = [
101+
new RegExp(`.+\/${username}-vscode-zsh\/\.zshrc`),
102+
new RegExp(`.+\/${username}-vscode-zsh\/\.zprofile`),
103+
new RegExp(`.+\/${username}-vscode-zsh\/\.zshenv`),
104+
new RegExp(`.+\/${username}-vscode-zsh\/\.zlogin`)
105+
];
99106
const expectedSources = [
100107
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-rc.zsh/,
101108
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-profile.zsh/,

0 commit comments

Comments
 (0)