hashicorp / go-plugin

Golang plugin system over RPC.
Mozilla Public License 2.0
5.25k stars 450 forks source link

Can't override environment variables when running a plugin #162

Open carolynvs opened 3 years ago

carolynvs commented 3 years ago

I want to modify an existing environment variable just for the plugin without affecting the environment variables of my current process. Right now any custom environment variables set on the plugin command are set first, and then the ambient environment variables are set second, undoing changes to an existing environment variable.

https://github.com/hashicorp/go-plugin/blob/0c19a1387af146eaa3335dad0a021741344ac3e9/client.go#L530

I'll follow-up with a PR to switch it to the following to enable this scenario if that's okay.

cmd.Env = append(os.Environ(), cmd.Env...)