@@ -120,8 +120,10 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
120
120
this ,
121
121
this . disposables ,
122
122
) ;
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 ) {
125
127
traceWarn ( `Shell integration is not active, environment activated maybe overriden by the shell.` ) ;
126
128
}
127
129
this . registeredOnce = true ;
@@ -182,7 +184,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
182
184
183
185
// PS1 in some cases is a shell variable (not an env variable) so "env" might not contain it, calculate it in that case.
184
186
env . PS1 = await this . getPS1 ( shell , resource , env ) ;
185
- const prependOptions = this . getPrependOptions ( ) ;
187
+ const prependOptions = this . getPrependOptions ( shell ) ;
186
188
187
189
// Clear any previously set env vars from collection
188
190
envVarCollection . clear ( ) ;
@@ -275,7 +277,7 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
275
277
// PS1 should be set but no PS1 was set.
276
278
return ;
277
279
}
278
- const config = this . isShellIntegrationActive ( ) ;
280
+ const config = this . isShellIntegrationActive ( shell ) ;
279
281
if ( ! config ) {
280
282
traceVerbose ( 'PS1 is not set when shell integration is disabled.' ) ;
281
283
return ;
@@ -330,8 +332,8 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
330
332
}
331
333
}
332
334
333
- private getPrependOptions ( ) : EnvironmentVariableMutatorOptions {
334
- const isActive = this . isShellIntegrationActive ( ) ;
335
+ private getPrependOptions ( shell : string ) : EnvironmentVariableMutatorOptions {
336
+ const isActive = this . isShellIntegrationActive ( shell ) ;
335
337
// Ideally we would want to prepend exactly once, either at shell integration or process creation.
336
338
// TODO: Stop prepending altogether once https://github.com/microsoft/vscode/issues/145234 is available.
337
339
return isActive
@@ -345,14 +347,11 @@ export class TerminalEnvVarCollectionService implements IExtensionActivationServ
345
347
} ;
346
348
}
347
349
348
- private isShellIntegrationActive ( ) : boolean {
350
+ private isShellIntegrationActive ( shell : string ) : boolean {
349
351
const isEnabled = this . workspaceService
350
352
. getConfiguration ( 'terminal' )
351
353
. get < boolean > ( 'integrated.shellIntegration.enabled' ) ! ;
352
- if (
353
- isEnabled &&
354
- ShellIntegrationShells . includes ( identifyShellFromShellPath ( this . applicationEnvironment . shell ) )
355
- ) {
354
+ if ( isEnabled && ShellIntegrationShells . includes ( identifyShellFromShellPath ( shell ) ) ) {
356
355
// Unfortunately shell integration could still've failed in remote scenarios, we can't know for sure:
357
356
// https://code.visualstudio.com/docs/terminal/shell-integration#_automatic-script-injection
358
357
return true ;
0 commit comments