@@ -55,7 +55,7 @@ import { selectFromCommonPackagesToInstall } from '../common/pickers';
5555import { Installable } from '../common/types' ;
5656import { shortVersion , sortEnvironments } from '../common/utils' ;
5757import { CondaEnvManager } from './condaEnvManager' ;
58- import { getCondaHookPs1Path , getLocalActivationScript } from './condaSourcingUtils' ;
58+ import { getCondaHookPs1Path , getLocalActivationScript , SHELL_SOURCING_SCRIPT_INDEX } from './condaSourcingUtils' ;
5959import { createStepBasedCondaFlow } from './condaStepBasedFlow' ;
6060
6161export const CONDA_PATH_KEY = `${ ENVS_EXTENSION_ID } :conda:CONDA_PATH` ;
@@ -512,10 +512,16 @@ async function buildShellActivationMapForConda(
512512 // P3: Handle Windows specifically ;this is carryover from vscode-python
513513 if ( isWindows ( ) ) {
514514 logs . push ( '✓ Using Windows-specific activation configuration' ) ;
515+ // Get conda.sh for bash-based shells (Git Bash, WSL bash)
516+ const condaShPath = envManager . sourcingInformation . shellSourcingScripts ?. [ SHELL_SOURCING_SCRIPT_INDEX . SH ] ;
517+ if ( ! condaShPath ) {
518+ logs . push ( 'conda.sh not found, falling back to global sourcing script for bash activation' ) ;
519+ }
515520 shellMaps = await windowsExceptionGenerateConfig (
516521 preferredSourcingPath ,
517522 envIdentifier ,
518523 envManager . sourcingInformation . condaFolder ,
524+ condaShPath ,
519525 ) ;
520526 return shellMaps ;
521527 }
@@ -580,6 +586,7 @@ async function windowsExceptionGenerateConfig(
580586 sourceInitPath : string ,
581587 prefix : string ,
582588 condaFolder : string ,
589+ condaShPath ?: string ,
583590) : Promise < ShellCommandMaps > {
584591 const shellActivation : Map < string , PythonCommandRunConfiguration [ ] > = new Map ( ) ;
585592 const shellDeactivation : Map < string , PythonCommandRunConfiguration [ ] > = new Map ( ) ;
@@ -593,7 +600,10 @@ async function windowsExceptionGenerateConfig(
593600 const pwshActivate = [ { executable : activation } , { executable : 'conda' , args : [ 'activate' , quotedPrefix ] } ] ;
594601 const cmdActivate = [ { executable : sourceInitPath } , { executable : 'conda' , args : [ 'activate' , quotedPrefix ] } ] ;
595602
596- const bashActivate = [ { executable : 'source' , args : [ sourceInitPath . replace ( / \\ / g, '/' ) , quotedPrefix ] } ] ;
603+ // Use conda.sh for bash-based shells (Git Bash) instead of activate.bat
604+ // conda.sh is the proper initialization script for bash shells
605+ const bashSourcePath = condaShPath ?? sourceInitPath ;
606+ const bashActivate = [ { executable : 'source' , args : [ bashSourcePath . replace ( / \\ / g, '/' ) , quotedPrefix ] } ] ;
597607 traceVerbose (
598608 `Windows activation commands:
599609 PowerShell: ${ JSON . stringify ( pwshActivate ) } ,
0 commit comments