Skip to content
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

Apply custom env variables to terminal when in pythonTerminalEnvVarActivation experiment #21879

Merged
merged 1 commit into from
Aug 28, 2023
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
6 changes: 4 additions & 2 deletions src/client/common/process/processFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<IProcessService> {
const customEnvVars = await this.envVarsService.getEnvironmentVariables(resource);
public async create(resource?: Uri, options?: { doNotUseCustomEnvs: boolean }): Promise<IProcessService> {
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));
Expand Down
2 changes: 1 addition & 1 deletion src/client/common/process/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface IProcessService extends IDisposable {
export const IProcessServiceFactory = Symbol('IProcessServiceFactory');

export interface IProcessServiceFactory {
create(resource?: Uri): Promise<IProcessService>;
create(resource?: Uri, options?: { doNotUseCustomEnvs: boolean }): Promise<IProcessService>;
}

export const IPythonExecutionFactory = Symbol('IPythonExecutionFactory');
Expand Down
2 changes: 1 addition & 1 deletion src/client/interpreter/activation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading