Skip to content

Commit

Permalink
Do not throw if initializing deactivate script fails (#22566)
Browse files Browse the repository at this point in the history
For #20950
  • Loading branch information
Kartik Raj authored Nov 29, 2023
1 parent caa50dc commit db6e15e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/terminals/envCollectionActivation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
envVarCollection.description = description;

await this.trackTerminalPrompt(shell, resource, env);
await this.terminalDeactivateService.initializeScriptParams(shell);
await this.terminalDeactivateService.initializeScriptParams(shell).catch((ex) => {
traceError(`Failed to initialize deactivate script`, shell, ex);
});
}

private isPromptSet = new Map<number | undefined, boolean>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ suite('Terminal Environment Variable Collection Service', () => {

test('Also prepend deactivate script location if available', async () => {
reset(terminalDeactivateService);
when(terminalDeactivateService.initializeScriptParams(anything())).thenResolve();
when(terminalDeactivateService.getScriptLocation(anything(), anything())).thenResolve('scriptLocation');
const processEnv = { PATH: 'hello/1/2/3' };
reset(environmentActivationService);
Expand Down Expand Up @@ -409,6 +410,7 @@ suite('Terminal Environment Variable Collection Service', () => {

test('Prepend full PATH with separator otherwise', async () => {
reset(terminalDeactivateService);
when(terminalDeactivateService.initializeScriptParams(anything())).thenResolve();
when(terminalDeactivateService.getScriptLocation(anything(), anything())).thenResolve('scriptLocation');
const processEnv = { PATH: 'hello/1/2/3' };
reset(environmentActivationService);
Expand Down

0 comments on commit db6e15e

Please sign in to comment.