Commit c384220
authored
## Summary
On Windows with Git Bash as the default terminal, the extension was
attempting to activate conda environments using `activate.bat` (CMD
batch script), which fails in bash:
```bash
$ source C:/Tools/miniforge3/Scripts/activate.bat pipes
bash: C:/Tools/miniforge3/Scripts/activate.bat: line 1: syntax error near unexpected token `('
```
## Root Cause
The `windowsExceptionGenerateConfig` function was using the same
`sourceInitPath` (which is `activate.bat` on Windows) for all shells,
including Git Bash.
## Fix
- Pass `conda.sh` path to `windowsExceptionGenerateConfig` for proper
bash-based shell activation
- Use two commands for bash when `conda.sh` is available: `source
<conda.sh>` + `conda activate <env>`
- Skip Git Bash activation entirely when `conda.sh` is unavailable and
`sourceInitPath` is `.bat`
- Refactored `shellSourcingScripts` from array with fragile indices to
typed `ShellSourcingScripts` interface
## Changes
- [condaUtils.ts](src/managers/conda/condaUtils.ts): Extract and pass
`condaShPath` to `windowsExceptionGenerateConfig`, use two-command
activation for bash, skip activation when only `.bat` is available
- [condaSourcingUtils.ts](src/managers/conda/condaSourcingUtils.ts): Add
`ShellSourcingScripts` interface replacing fragile array indices
-
[condaUtils.windowsActivation.unit.test.ts](src/test/managers/conda/condaUtils.windowsActivation.unit.test.ts):
Add unit tests for Windows shell activation
## Testing
- Pre-commit checks pass (lint, tsc, unit tests)
- Manual testing needed on Windows with Git Bash + conda
Fixes #1247
1 parent 0b9d327 commit c384220
File tree
5 files changed
+296
-18
lines changed- src
- features/terminal/shells/common
- managers/conda
- test
- features/terminal/shells/common
- managers/conda
5 files changed
+296
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
9 | 22 | | |
10 | 23 | | |
11 | 24 | | |
| |||
16 | 29 | | |
17 | 30 | | |
18 | 31 | | |
19 | | - | |
| 32 | + | |
20 | 33 | | |
21 | 34 | | |
22 | 35 | | |
23 | 36 | | |
24 | 37 | | |
25 | 38 | | |
26 | | - | |
| 39 | + | |
27 | 40 | | |
28 | 41 | | |
29 | 42 | | |
| |||
40 | 53 | | |
41 | 54 | | |
42 | 55 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
52 | 73 | | |
53 | 74 | | |
54 | 75 | | |
| |||
120 | 141 | | |
121 | 142 | | |
122 | 143 | | |
123 | | - | |
| 144 | + | |
124 | 145 | | |
125 | 146 | | |
126 | 147 | | |
| |||
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
173 | | - | |
| 194 | + | |
174 | 195 | | |
175 | 196 | | |
176 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
512 | 512 | | |
513 | 513 | | |
514 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
515 | 520 | | |
516 | 521 | | |
517 | 522 | | |
518 | 523 | | |
| 524 | + | |
519 | 525 | | |
520 | 526 | | |
521 | 527 | | |
| |||
576 | 582 | | |
577 | 583 | | |
578 | 584 | | |
579 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
580 | 591 | | |
581 | 592 | | |
582 | 593 | | |
| 594 | + | |
583 | 595 | | |
584 | 596 | | |
585 | 597 | | |
| |||
593 | 605 | | |
594 | 606 | | |
595 | 607 | | |
596 | | - | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
597 | 628 | | |
598 | 629 | | |
599 | 630 | | |
| |||
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 102 | + | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
| |||
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
187 | 207 | | |
188 | 208 | | |
0 commit comments