@@ -120,8 +120,10 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
120120 this ,
121121 this . disposables ,
122122 ) ;
123- const isActive = this . isShellIntegrationActive ( ) ;
124- if ( ! isActive ) {
123+ const { shell } = this . applicationEnvironment ;
124+ const isActive = this . isShellIntegrationActive ( shell ) ;
125+ const shellType = identifyShellFromShellPath ( shell ) ;
126+ if ( ! isActive && shellType !== TerminalShellType . commandPrompt ) {
125127 traceWarn ( `Shell integration is not active, environment activated maybe overriden by the shell.` ) ;
126128 }
127129 this . registeredOnce = true ;
@@ -182,7 +184,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
182184
183185 // PS1 in some cases is a shell variable (not an env variable) so "env" might not contain it, calculate it in that case.
184186 env . PS1 = await this . getPS1 ( shell , resource , env ) ;
185- const prependOptions = this . getPrependOptions ( ) ;
187+ const prependOptions = this . getPrependOptions ( shell ) ;
186188
187189 // Clear any previously set env vars from collection
188190 envVarCollection . clear ( ) ;
@@ -275,7 +277,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
275277 // PS1 should be set but no PS1 was set.
276278 return ;
277279 }
278- const config = this . isShellIntegrationActive ( ) ;
280+ const config = this . isShellIntegrationActive ( shell ) ;
279281 if ( ! config ) {
280282 traceVerbose ( 'PS1 is not set when shell integration is disabled.' ) ;
281283 return ;
@@ -330,8 +332,8 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
330332 }
331333 }
332334
333- private getPrependOptions ( ) : EnvironmentVariableMutatorOptions {
334- const isActive = this . isShellIntegrationActive ( ) ;
335+ private getPrependOptions ( shell : string ) : EnvironmentVariableMutatorOptions {
336+ const isActive = this . isShellIntegrationActive ( shell ) ;
335337 // Ideally we would want to prepend exactly once, either at shell integration or process creation.
336338 // TODO: Stop prepending altogether once https://github.com/microsoft/vscode/issues/145234 is available.
337339 return isActive
@@ -345,14 +347,11 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
345347 } ;
346348 }
347349
348- private isShellIntegrationActive ( ) : boolean {
350+ private isShellIntegrationActive ( shell : string ) : boolean {
349351 const isEnabled = this . workspaceService
350352 . getConfiguration ( 'terminal' )
351353 . get < boolean > ( 'integrated.shellIntegration.enabled' ) ! ;
352- if (
353- isEnabled &&
354- ShellIntegrationShells . includes ( identifyShellFromShellPath ( this . applicationEnvironment . shell ) )
355- ) {
354+ if ( isEnabled && ShellIntegrationShells . includes ( identifyShellFromShellPath ( shell ) ) ) {
356355 // Unfortunately shell integration could still've failed in remote scenarios, we can't know for sure:
357356 // https://code.visualstudio.com/docs/terminal/shell-integration#_automatic-script-injection
358357 return true ;
0 commit comments