Skip to content

Improvements to pythonTerminalEnvVarActivation experiment #21751

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 16 commits into from
Aug 4, 2023
Prev Previous commit
Next Next commit
Fix activation for powershell
  • Loading branch information
Kartik Raj committed Aug 3, 2023
commit 2092cead6696319809622e73e3cab1da620adf9f
5 changes: 3 additions & 2 deletions src/client/interpreter/activation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
args.forEach((arg, i) => {
args[i] = arg.toCommandArgumentForPythonExt();
});
const command = `echo '${ENVIRONMENT_PREFIX}' && ${interpreterPath} ${args.join(' ')}`;
const command = `${interpreterPath} ${args.join(' ')}`;
const processService = await this.processServiceFactory.create(resource);
const result = await processService.shellExec(command, {
shell: shell,
Expand Down Expand Up @@ -277,7 +277,8 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
const activationCommand = fixActivationCommands(activationCommands).join(' && ');
// In order to make sure we know where the environment output is,
// put in a dummy echo we can look for
command = `${activationCommand} && echo '${ENVIRONMENT_PREFIX}' && python ${args.join(' ')}`;
const commandSeparator = [TerminalShellType.powershell, TerminalShellType.powershellCore].includes(shellInfo.shellType) ? ';' : '&&';
command = `${activationCommand} ${commandSeparator} echo '${ENVIRONMENT_PREFIX}' ${commandSeparator} python ${args.join(' ')}`;
}

// Make sure python warnings don't interfere with getting the environment. However
Expand Down