Commit 6ecaf33
committed
fix(opencode): inherit user shell PATH when spawning opencode serve
macOS GUI launches inherit launchd's minimal PATH
(/usr/bin:/bin:/usr/sbin:/sbin), which prevents opencode serve and any
tool it spawns (e.g. rust-analyzer for the oh-my-opencode plugin's
lsp_diagnostics tool) from finding user-installed binaries. The fork
already has this exact problem solved for the extension host via
getResolvedShellEnv(); we just weren't using it for the OpenCode backend.
Inject IEnvironmentMainService into OpencodeServeManager and call
getResolvedShellEnv() before spawning. The result is cached at module
level so subsequent restarts (respawn) reuse it without re-spawning the
shell. Windows and CLI launches short-circuit inside getResolvedShellEnv,
so they keep their existing behavior.
Also thread the merged env into findBinaryOnPath()'s 'which opencode'
execSync so binary discovery sees the same PATH the spawn will use.1 parent 3ca39f2 commit 6ecaf33
2 files changed
Lines changed: 48 additions & 5 deletions
File tree
- src/vs/workbench/contrib/opencode
- electron-main
- test/electron-main
Lines changed: 33 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
200 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
206 | 214 | | |
207 | 215 | | |
208 | | - | |
| 216 | + | |
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
| |||
464 | 472 | | |
465 | 473 | | |
466 | 474 | | |
467 | | - | |
| 475 | + | |
468 | 476 | | |
469 | 477 | | |
470 | 478 | | |
| |||
478 | 486 | | |
479 | 487 | | |
480 | 488 | | |
481 | | - | |
| 489 | + | |
482 | 490 | | |
483 | 491 | | |
484 | 492 | | |
| |||
495 | 503 | | |
496 | 504 | | |
497 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
498 | 524 | | |
499 | 525 | | |
500 | 526 | | |
| |||
579 | 605 | | |
580 | 606 | | |
581 | 607 | | |
582 | | - | |
| 608 | + | |
583 | 609 | | |
584 | 610 | | |
585 | 611 | | |
586 | 612 | | |
587 | 613 | | |
588 | 614 | | |
589 | 615 | | |
| 616 | + | |
590 | 617 | | |
591 | 618 | | |
592 | 619 | | |
| |||
721 | 748 | | |
722 | 749 | | |
723 | 750 | | |
| 751 | + | |
724 | 752 | | |
725 | 753 | | |
726 | 754 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
143 | 153 | | |
144 | 154 | | |
145 | 155 | | |
| |||
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
157 | 172 | | |
158 | 173 | | |
159 | 174 | | |
| |||
0 commit comments