Skip to content

Commit 62cdc17

Browse files
Merge pull request #6157 from continuedev/pe/mcp-shell-fix
Update shellPath.ts
2 parents e310b06 + 31f63c7 commit 62cdc17

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

core/util/shellPath.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 @@ export function getEnvPathFromUserShell(): string | undefined {
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",

0 commit comments

Comments
 (0)