From 9e85933d67cfbc950975e4d4b68ee8b6f1b1121c Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 29 Nov 2023 10:43:24 -0800 Subject: [PATCH 1/2] Do not throw if initializing deactivate script fails --- src/client/terminals/envCollectionActivation/service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/terminals/envCollectionActivation/service.ts b/src/client/terminals/envCollectionActivation/service.ts index 68c098c4c928..b9a9fc17b3d5 100644 --- a/src/client/terminals/envCollectionActivation/service.ts +++ b/src/client/terminals/envCollectionActivation/service.ts @@ -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(); From 5edcd12c5814c5d9b9e603c0c42040c7a8e4cb94 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Wed, 29 Nov 2023 10:56:50 -0800 Subject: [PATCH 2/2] fix unit --- .../activation/terminalEnvVarCollectionService.unit.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/interpreters/activation/terminalEnvVarCollectionService.unit.test.ts b/src/test/interpreters/activation/terminalEnvVarCollectionService.unit.test.ts index 55e0b80d3e1e..daf3150fdbd0 100644 --- a/src/test/interpreters/activation/terminalEnvVarCollectionService.unit.test.ts +++ b/src/test/interpreters/activation/terminalEnvVarCollectionService.unit.test.ts @@ -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); @@ -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);