mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
get zsh startup files to run in the correct order (#147434)
This commit is contained in:
@@ -193,6 +193,14 @@ export function getShellIntegrationInjection(
|
||||
source: path.join(appRoot, 'out/vs/workbench/contrib/terminal/browser/media/shellIntegration.zsh'),
|
||||
dest: path.join(zdotdir, '.zshrc')
|
||||
});
|
||||
filesToCopy.push({
|
||||
source: path.join(appRoot, 'out/vs/workbench/contrib/terminal/browser/media/shellIntegration-profile.zsh'),
|
||||
dest: path.join(zdotdir, '.zprofile')
|
||||
});
|
||||
filesToCopy.push({
|
||||
source: path.join(appRoot, 'out/vs/workbench/contrib/terminal/browser/media/shellIntegration-env.zsh'),
|
||||
dest: path.join(zdotdir, '.zshenv')
|
||||
});
|
||||
if (!options.showWelcome) {
|
||||
envMixin['VSCODE_SHELL_HIDE_WELCOME'] = '1';
|
||||
}
|
||||
|
||||
@@ -87,14 +87,22 @@ suite('platform - terminalEnvironment', () => {
|
||||
suite('zsh', () => {
|
||||
suite('should override args', () => {
|
||||
const expectedDir = /.+\/vscode-zsh/;
|
||||
const expectedDest = /.+\/vscode-zsh\/.zshrc/;
|
||||
const expectedSource = /.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration.zsh/;
|
||||
const expectedDests = [/.+\/vscode-zsh\/.zshrc/, /.+\/vscode-zsh\/.zprofile/, /.+\/vscode-zsh\/.zshenv/];
|
||||
const expectedSources = [
|
||||
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration.zsh/,
|
||||
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-profile.zsh/,
|
||||
/.+\/out\/vs\/workbench\/contrib\/terminal\/browser\/media\/shellIntegration-env.zsh/
|
||||
];
|
||||
function assertIsEnabled(result: IShellIntegrationConfigInjection) {
|
||||
strictEqual(Object.keys(result.envMixin!).length, 1);
|
||||
ok(result.envMixin!['ZDOTDIR']?.match(expectedDir));
|
||||
strictEqual(result.filesToCopy?.length, 1);
|
||||
ok(result.filesToCopy[0].dest.match(expectedDest));
|
||||
ok(result.filesToCopy[0].source.match(expectedSource));
|
||||
strictEqual(result.filesToCopy?.length, 3);
|
||||
ok(result.filesToCopy[0].dest.match(expectedDests[0]));
|
||||
ok(result.filesToCopy[1].dest.match(expectedDests[1]));
|
||||
ok(result.filesToCopy[2].dest.match(expectedDests[2]));
|
||||
ok(result.filesToCopy[0].source.match(expectedSources[0]));
|
||||
ok(result.filesToCopy[1].source.match(expectedSources[1]));
|
||||
ok(result.filesToCopy[2].source.match(expectedSources[2]));
|
||||
}
|
||||
test('when undefined, []', () => {
|
||||
const result1 = getShellIntegrationInjection({ executable: 'zsh', args: [] }, enabledProcessOptions);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
|
||||
if [[ $options[norcs] = off && -o "login" && -f ~/.zshenv ]]; then
|
||||
. ~/.zshenv
|
||||
fi
|
||||
@@ -0,0 +1,8 @@
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
# ---------------------------------------------------------------------------------------------
|
||||
|
||||
if [[ $options[norcs] = off && -o "login" && -f ~/.zprofile ]]; then
|
||||
. ~/.zprofile
|
||||
fi
|
||||
@@ -12,13 +12,8 @@ builtin unset ZDOTDIR
|
||||
# as disable it by unsetting the variable.
|
||||
VSCODE_SHELL_INTEGRATION=1
|
||||
|
||||
if [ -f ~/.zshenv ]; then
|
||||
. ~/.zshenv
|
||||
fi
|
||||
if [[ -o "login" && -f ~/.zprofile ]]; then
|
||||
. ~/.zprofile
|
||||
fi
|
||||
if [ -f ~/.zshrc ]; then
|
||||
|
||||
if [[ $options[norcs] = off && -f ~/.zshrc ]]; then
|
||||
. ~/.zshrc
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user