Skip to content

Run fish activation scripts with source instead of `. #7541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion news/2 Fixes/7343.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ export class Bash extends BaseActivationCommandProvider {
if (!scriptFile) {
return;
}
if (targetShell === TerminalShellType.fish) {
return [`. ${scriptFile.fileToCommandArgument()}`];
} else {
return [`source ${scriptFile.fileToCommandArgument()}`];
}
return [`source ${scriptFile.fileToCommandArgument()}`];
}

private getScriptsInOrderOfPreference(targetShell: TerminalShellType): string[] {
Expand Down
3 changes: 1 addition & 2 deletions src/test/common/terminals/activation.bash.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ suite('Terminal Environment Activation (bash)', () => {
const command = await bash.getActivationCommands(undefined, shellType.value);

if (isScriptFileSupported) {
const sourceCmd = shellType.value === TerminalShellType.fish ? '.' : 'source';
// Ensure the script file is of the following form:
// source "<path to script file>" <environment name>
// Ensure the path is quoted if it contains any spaces.
// Ensure it contains the name of the environment as an argument to the script file.

expect(command).to.be.deep.equal([`${sourceCmd} ${pathToScriptFile.fileToCommandArgument()}`.trim()], 'Invalid command');
expect(command).to.be.deep.equal([`source ${pathToScriptFile.fileToCommandArgument()}`.trim()], 'Invalid command');
} else {
expect(command).to.be.equal(undefined, 'Command should be undefined');
}
Expand Down