0

Please, find below a few environment variables I can see in the VS Code integrated git-bash:

~$ for var in PSMODULEPATH LIB LIBPATH INCLUDE EXTERNAL_INCLUDE ORIGINAL_PATH PATH; do echo "\${#$var} = $(eval echo \${#$var})"; done
${#PSMODULEPATH} = 450
${#LIB} = 176
${#LIBPATH} = 173
${#INCLUDE} = 387
${#EXTERNAL_INCLUDE} = 387
${#ORIGINAL_PATH} = 7555
${#PATH} = 9683

~$

Now, if I run the same command on the standalone git-bash console I get this:

~$ for var in PSMODULEPATH LIB LIBPATH INCLUDE EXTERNAL_INCLUDE ORIGINAL_PATH PATH; do echo "\${#$var} = $(eval echo \${#$var})"; done
${#PSMODULEPATH} = 0
${#LIB} = 0
${#LIBPATH} = 0
${#INCLUDE} = 0
${#EXTERNAL_INCLUDE} = 0
${#ORIGINAL_PATH} = 0
${#PATH} = 2228

~$

I know 100% that both terminals are git-bash and they do evaluate the ~/.bashrc file. Both return the same thing for echo $0 or for the different $BASH_XYZ variables.

However, something additional happens in VS Code. It adds all kinds of environment variables and seems to botch the PATH environment variable royally. In my standalone git-bash:

~$ echo $PATH | grep ';'

~$

But in VS Code:

~$ echo $PATH | grep ';' | wc -c
9684

~$

This is all very weird. And it breaks the xargs command.

My question is - what does VS Code do exactly to populate the git bash environment and how can we make it behave sanely?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.