ashald / EnvFile

EnvFile 3.x is a plugin for JetBrains IDEs that allows you to set environment variables for your run configurations from one or multiple files.
MIT License
535 stars 126 forks source link

Use parent environment to allow variable substitution #165

Closed jansorg closed 1 year ago

jansorg commented 2 years ago

I'm experimenting to support EnvFile with [BashSupport Pro}(https://www.bashsupport.com). I noticed that the variable substitution isn't working as it should.

Currently EnvFile only provides the variables configured directly in the run configuration to the var env providers. Now, if a variable substitution references a variable, which is inherited from the parent environment, then it has an empty value. That's happening because eneralCommandLine.getEnvironment() is not including the variables from the parent environment.

The SDK's process setup adds the parent environment variables to the new process, if the setting for this is enabled: https://github.com/JetBrains/intellij-community/blob/8e89a51b18059a34081c84439c6c19483f64ad10/platform/platform-util-io/src/com/intellij/execution/configurations/GeneralCommandLine.java#L469

EnvFile must follow the same logic to provide the same set of variables to the patched command line. I successfully tested this with Python, the other modified providers follow the same logic.

I don't know much about EnvFile, but hope that this is helpful.

jansorg commented 2 years ago

Can I help with anything to get this merged?