Elffuss BraidHub

kikocis/continue public

Merge pull request #6157 from continuedev/pe/mcp-shell-fix

Update shellPath.ts
Changesetac2607cb12989970074a835dbd6e3ea53a42edd88f184e9a061539482b620b25
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-17 08:54 -07:00
CommitterGitHub <noreply@github.com> · 2025-06-17 08:54 -07:00
Parents681f4f45131e, d077bc7a38b2

Browse the files at this changeset

1 file changed

modified core/util/shellPath.ts +3 −6
@@ -1,10 +1,6 @@
11 import { execSync } from "child_process";
2+import { homedir } from "os";
23
3-/**
4- * Gets the PATH env var from the user's login shell on non-Windows platforms.
5- * Windows is not implemented primarily because it is not needed at the moment.
6- * @returns The enhanced PATH from the user's shell, or the current PATH if it cannot be determined
7- */
84 export function getEnvPathFromUserShell(): string | undefined {
95 if (process.platform === "win32") {
106 console.warn(`${getEnvPathFromUserShell.name} not implemented for Windows`);
@@ -16,7 +12,8 @@
1612 }
1713
1814 try {
19- const command = `${process.env.SHELL} -l -c 'echo $PATH'`;
15+ // Source common profile files
16+ const command = `${process.env.SHELL} -l -c 'for f in ~/.zprofile ~/.zshrc ~/.bash_profile ~/.bashrc; do [ -f "$f" ] && source "$f" 2>/dev/null; done; echo $PATH'`;
2017
2118 const stdout = execSync(command, {
2219 encoding: "utf8",