File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 11import { 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- */
84export 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" ,
You can’t perform that action at this time.
0 commit comments