Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export class PipEnvActivationCommandProvider implements ITerminalActivationComma
}

const execName = this.pipenvService.executable;
return [`${execName} shell`];
return [`${execName.toCommandArgument()} shell`];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { InterpreterService } from '../../../../client/interpreter/interpreterSe
suite('Terminals Activation - Pipenv', () => {
[undefined, Uri.parse('x')].forEach(resource => {
suite(resource ? 'With a resource' : 'Without a resource', () => {
let pipenvExecFile = 'pipenv';
let activationProvider: ITerminalActivationCommandProvider;
let interpreterService: IInterpreterService;
let pipenvService: TypeMoq.IMock<IPipEnvService>;
Expand All @@ -29,7 +30,7 @@ suite('Terminals Activation - Pipenv', () => {
pipenvService.object
);

pipenvService.setup(p => p.executable).returns(() => 'pipenv');
pipenvService.setup(p => p.executable).returns(() => pipenvExecFile);
});

test('No commands for no interpreter', async () => {
Expand Down Expand Up @@ -63,6 +64,16 @@ suite('Terminals Activation - Pipenv', () => {
assert.deepEqual(cmd, ['pipenv shell']);
}
});
test('pipenv is properly escaped', async () => {
pipenvExecFile = 'my pipenv';
when(interpreterService.getActiveInterpreter(resource)).thenResolve({ type: InterpreterType.Pipenv } as any);

for (const shell of getNamesAndValues<TerminalShellType>(TerminalShellType)) {
const cmd = await activationProvider.getActivationCommands(resource, shell.value);

assert.deepEqual(cmd, ['"my pipenv" shell']);
}
});
});
});
});