Skip to content

Commit 98428cd

Browse files
author
Kartik Raj
authored
Apply custom env variables to terminal when in pythonTerminalEnvVarActivation experiment (#21879)
For #944 #20822 We only apply those env vars to terminal which are not in process env variables, hence remove custom env vars from process variables.
1 parent 3fa5d4b commit 98428cd

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/client/common/process/processFactory.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ export class ProcessServiceFactory implements IProcessServiceFactory {
1717
@inject(IProcessLogger) private readonly processLogger: IProcessLogger,
1818
@inject(IDisposableRegistry) private readonly disposableRegistry: IDisposableRegistry,
1919
) {}
20-
public async create(resource?: Uri): Promise<IProcessService> {
21-
const customEnvVars = await this.envVarsService.getEnvironmentVariables(resource);
20+
public async create(resource?: Uri, options?: { doNotUseCustomEnvs: boolean }): Promise<IProcessService> {
21+
const customEnvVars = options?.doNotUseCustomEnvs
22+
? undefined
23+
: await this.envVarsService.getEnvironmentVariables(resource);
2224
const proc: IProcessService = new ProcessService(customEnvVars);
2325
this.disposableRegistry.push(proc);
2426
return proc.on('exec', this.processLogger.logProcess.bind(this.processLogger));

src/client/common/process/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface IProcessService extends IDisposable {
5555
export const IProcessServiceFactory = Symbol('IProcessServiceFactory');
5656

5757
export interface IProcessServiceFactory {
58-
create(resource?: Uri): Promise<IProcessService>;
58+
create(resource?: Uri, options?: { doNotUseCustomEnvs: boolean }): Promise<IProcessService>;
5959
}
6060

6161
export const IPythonExecutionFactory = Symbol('IPythonExecutionFactory');

src/client/interpreter/activation/service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
192192
args[i] = arg.toCommandArgumentForPythonExt();
193193
});
194194
const command = `${interpreterPath} ${args.join(' ')}`;
195-
const processService = await this.processServiceFactory.create(resource);
195+
const processService = await this.processServiceFactory.create(resource, { doNotUseCustomEnvs: true });
196196
const result = await processService.shellExec(command, {
197197
shell,
198198
timeout: ENVIRONMENT_TIMEOUT,

0 commit comments

Comments
 (0)