Changesets · Branches · Tags · Compare
| Changeset | d077bc7a38b2b193d223b1f32f035b20eb0f519a74daa58dc08c61a32384c554 |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-16 18:55 -07:00 |
| Committer | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-16 18:55 -07:00 |
| Parents | c3e8fbcfb752 |
1 file changed
modified core/util/shellPath.ts +3 −6
| @@ -1,10 +1,6 @@ | ||
| 1 | 1 | import { execSync } from "child_process"; |
| 2 | +import { homedir } from "os"; | |
| 2 | 3 | |
| 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 | - */ | |
| 8 | 4 | export function getEnvPathFromUserShell(): string | undefined { |
| 9 | 5 | if (process.platform === "win32") { |
| 10 | 6 | console.warn(`${getEnvPathFromUserShell.name} not implemented for Windows`); |
| @@ -16,7 +12,8 @@ | ||
| 16 | 12 | } |
| 17 | 13 | |
| 18 | 14 | 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'`; | |
| 20 | 17 | |
| 21 | 18 | const stdout = execSync(command, { |
| 22 | 19 | encoding: "utf8", |