diff --git a/src/client/common/process/processFactory.ts b/src/client/common/process/processFactory.ts index 8681d5073d8e..40204a640dae 100644 --- a/src/client/common/process/processFactory.ts +++ b/src/client/common/process/processFactory.ts @@ -17,8 +17,10 @@ export class ProcessServiceFactory implements IProcessServiceFactory { @inject(IProcessLogger) private readonly processLogger: IProcessLogger, @inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry, ) {} - public async create(resource?: Uri): Promise { - const customEnvVars = await this.envVarsService.getEnvironmentVariables(resource); + public async create(resource?: Uri, options?: { doNotUseCustomEnvs: boolean }): Promise { + const customEnvVars = options?.doNotUseCustomEnvs + ? undefined + : await this.envVarsService.getEnvironmentVariables(resource); const proc: IProcessService = new ProcessService(customEnvVars); this.disposableRegistry.push(proc); return proc.on('exec', this.processLogger.logProcess.bind(this.processLogger)); diff --git a/src/client/common/process/types.ts b/src/client/common/process/types.ts index 62e787b694b5..d4b742718e36 100644 --- a/src/client/common/process/types.ts +++ b/src/client/common/process/types.ts @@ -55,7 +55,7 @@ export interface IProcessService extends IDisposable { export const IProcessServiceFactory = Symbol('IProcessServiceFactory'); export interface IProcessServiceFactory { - create(resource?: Uri): Promise; + create(resource?: Uri, options?: { doNotUseCustomEnvs: boolean }): Promise; } export const IPythonExecutionFactory = Symbol('IPythonExecutionFactory'); diff --git a/src/client/interpreter/activation/service.ts b/src/client/interpreter/activation/service.ts index 4364cc825f78..02d621c0ccda 100644 --- a/src/client/interpreter/activation/service.ts +++ b/src/client/interpreter/activation/service.ts @@ -192,7 +192,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi args[i] = arg.toCommandArgumentForPythonExt(); }); const command = `${interpreterPath} ${args.join(' ')}`; - const processService = await this.processServiceFactory.create(resource); + const processService = await this.processServiceFactory.create(resource, { doNotUseCustomEnvs: true }); const result = await processService.shellExec(command, { shell, timeout: ENVIRONMENT_TIMEOUT,